TypeScript
- Many bundlers, such as Webpack and Rolldown, implement tree shaking by default.
- ECMAScript introduced
const
variable definitions relatively recently.
- ESM is much easier to analyze statically than the other module systems like CommonJS.
`
const foo: number = 42;
const bar = (x: number): number => x * foo;
foo = 0;
bar = (x) => x;