Users of TypeScript 5.0, which currently is in a release candidate stage, will need to run Node.js 12 at a minimum. In return,
npm installs promise to execute a little faster and take up less space, with the
typescript package sized reduced by roughly 46%, Microsoft said in a March 9 bulletin. TypeScript too will be faster, with build times cut by 10% to 25%. API consumers of TypeScript likely will be unaffected.
TypeScript will not be shipping its API as ES modules yet. A CommonJS-authored API still will be provided, and existing build scripts will still work.
Providing background on the transition, Microsoft said the current TypeScript codebase predates ECMAScript modules, which were standardized in 2015. Not knowing how compatible ES modules would be with other module systems such as CommonJS, and not seeing a huge benefit for authoring in modules at the time, TypeScript instead used
namespaces, formerly called internal modules.
Moving to modules allows the builders of TypeScript to close the experience gap with their users, speed up the development of TypeScript, and make TypeScript faster, Microsoft said. However, while TypeScript is now written with modules, the actual JS files have not changed format. Libraries still act as CommonJS when executed in a CommonJS environment.
Copyright © 2023 IDG Communications, Inc.