When inside any TypeScript file (.ts, .tsx, .cts, or .mts) you may now write import statements to other TypeScript files, but using their would-be JavaScript extensions.
import aaa from './aaa.js';
// => loads the "aaa.ts" file
import bbb from './bbb.cjs';
// => loads the "bbb.cts" file
import ccc from './ccc.mjs';
// => loads the "ccc.mts" file
This is/will be supported officially by TypeScript. See here for more info
Closes #1
When inside any TypeScript file (
.ts
,.tsx
,.cts
, or.mts
) you may now writeimport
statements to other TypeScript files, but using their would-be JavaScript extensions.For example, assume this file structure:
And now the
main.ts
file includes the following:This is/will be supported officially by TypeScript. See here for more info