Post

📢 TypeScript 5.7 is here! Now with ✅ Better checks for uninitialized variables ✅ Smarter tsconfig lookup in editors ✅ Improved startup time ✅ Stricter checks for JSON imports ✅ Extension rewrites for relative imports and more! Try it today! devblogs.microsoft.com/typescript/a...

devblogs.microsoft.comAnnouncing TypeScript 5.7 - TypeScriptToday we excited to announce the availability of TypeScript 5.7! If you’re not familiar with TypeScript, it’s a language that builds on JavaScript by adding syntax for type declarations and annotation...

Honest question, must --target and --lib be in sync? Just from reading the docs I would have thought I could set lib to 2024 and target to 2022 and get to use new features while giving browsers the chance to catch up. If the two settings must be in sync, why isn’t it just a single setting?

They do not need to be in sync; sometimes they can't be. For example, not all versions of Node 20 support ES2022 syntax, but all support ES2023 runtime features. Often this happens when a specific syntax feature is buggy such that it should not be used, but unrelated lib stuff is okay.

(Not to mention the people setting target=ES5 to downlevel let/const to var for performance, but I would argue that TypeScript is the wrong tool to do that job)

0 reposts2 likes

The TDZ (temporal dead zone) created by let/const can have a high runtime cost, so sometimes, yes; used to be some 30% difference in TS, so we manually changed the important ones over to get most of that speedup I think V8 optimized some of it after this discovery but not all