Also in TypeScript 5.7 is a brand new compiler possibility, --rewriteRelativeImportExtensions
. When an import path is relative and ends with a TypeScript extension (.ts
, .tsx
, .mts
, .cts
), and it’s a non-declaration file, the compiler will rewrite the trail to the corresponding JavaScript extension (.js
, .jsx
, .mjs
, .cjs
). This permits for writing TypeScript code that may be run in place and be compiled into JavaScript code when prepared.
TypeScript 5.7 comes on the heels of the September launch of TypeScript 5.6, with capabilities together with disallowing nullish and truthy checks on syntax that by no means varies on nullishness or truthiness.
Other options in TypeScript 5.7 embody the next: