TypeScript Performance, Storybook 8 & Goodbye Remix
New TypeScript features, Remix dev tools and more
This week, we look at the latest updates to Next.js, some Josh Comeau magic and the latest from TypeScript as version 6 is released
The latest release of Next.js comes with a bunch of new performance improvements, some better debugging tools and some other AI-related features.
According to Vercel, this update includes:
--inspect flag when using next start so that you can attach a Node.js debugger to production builds.transitionTypes prop, which is an array of strings that specifies the types of View Transitions to apply when Navigating. This extends support for View Transitions in Next.js websites.This week, Josh Comeau gives us an insight into how he created his very cool sticky header effect on his blog, and it turns out that it's a lot simpler than you would expect.
Josh does a much better job of explaining things than I do, so I highly recommend reading the article. However, to very quickly break it down:
position: fixed to make it stick to the top of the browser windowposition: sticky element that is the same height as the navigation bar and the same background colour as the headerposition: sticky element that is the same height as the navigation bar, but with a white backgroundz-index than the sticky bar, but lower than the navigation, so that the bar goes behind themSimple, but very effective. I've wondered about doing something similar on this site, rather than having everything just blur underneath the navigation as it sticks to the top.
This week, Microsoft announced the release of TypeScript v6. I've done a bit of reading about TypeScript v7 recently, and by the sounds of it, this release is mostly about preparation for the release of v7 to make sure there are as few issues for people as possible.
TypeScript 6.0 acts as the bridge between TypeScript 5.9 and 7.0. As such, most changes in TypeScript 6.0 are meant to help align and prepare for adopting TypeScript 7.0. It may seem surprising to say, but TypeScript 7.0 is actually extremely close to completion. In fact, if you’re able to adopt TypeScript 6.0, we encourage you to try out the native previews of TypeScript 7.0.
There are some other minor features that have been added in this release, including:
#/ - this is actually a Node thing where, if you wanted to use a # character for your imports, you needed to add a name as well, and if you didn't, then you had to use #root/ and now you don't need the root bit1function matchWholeWord(word: string, text: string) {
2 const escapedWord = RegExp.escape(word);
3 const regex = new RegExp(`\\b${escapedWord}\\b`, "g");
4 return text.match(regex);
5}dom.iterable lib in order to iterate over DOM Nodes in a for loop 1// Before TypeScript 6.0, this required "lib": ["dom", "dom.iterable"]
2// Now it works with just "lib": ["dom"]
3for (const element of document.querySelectorAll("div")) {
4 console.log(element.textContent);
5}I've got a couple of things I found from Jhey this week. The first is a really cool effect, using View Transitions, to show how a light would look when lit on a list of products in an e-commerce site.
And also this little demo, which uses CSS anchor positioning, to transition a shape from one place to another (it also uses Draggable from GSAP to highlight the transition to different places):
Thanks for reading. See you next time
Alex is a Principal Front End Engineer currently working at Choreograph - a WPP company. He has over 15 years of experience in the web development industry.