πŸ“– tl;dr: TypeScript's new isolated declaration feature is a game changer for sharing code among developers. It significantly simplifies the process

Speeding up the JavaScript ecosystem - Isolated Declarations

submited by
Style Pass
2024-07-06 20:30:04

πŸ“– tl;dr: TypeScript's new isolated declaration feature is a game changer for sharing code among developers. It significantly simplifies the process of packaging your code for consumption whilst reducing the time to create type definition files from minutes, sometimes even hours, down to less than a second.

Unbeknownst to many, the new isolatedDeclaration feature shipped in TypeScript 5.5 is much more important than you might realize. It just revolutionized how we package and distribute JavaScript code. You don't need to create *.d.ts files manually anymore. "Go to source" (the thing when you do ctrl+click or cmd+click on macOS) actually works now and it leads you right to the TypeScript source code instead of a *.d.ts file or some compiled JavaScript code. And on top of it all it makes publishing packages way faster than ever before.

Honestly, it's a mess. There is no point in sugar-coating it. A buddy of mine wanted to publish his first every library on npm, but was quickly discouraged when he realized how much work and specialized knowledge that entails. You have to care about CommonJS vs ESM, fiddle with a bunch of settings to make *.d.ts files work and the list goes on. In the end, he aborted the mission and instead just copy and pasted files between his projects around. It was much less of a hassle compared to having to deal with all the packaging woes.

Leave a Comment