Description
π Search Terms
β Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
β Context
Nodejs is shipping built-in TypeScript support for local & development projects, where distributing for production still need to compile typescript sources to javascript for them to work.
This can be used in version >=22.6.0
behind the --experimental-strip-types
flag.
A point of contention is that the Nodejs TypeScript transpiler relies on importing TypeScript sources using the .ts
file extension.
Example;
// node --experimental-strip-types ./index.ts
// index.ts
import * as foo from './foo.ts'
While we can use the new Nodejs flag to run local TypeScript sources during development with .ts
file extensions and tsconfig.json#compilerOptions.allowImportingTsExtensions: true
; The TypeScript compiler is no longer capable of producing a valid output to run in Nodejs using this source code.
β Discussion
In previous issues, members of the TypeScript team have stated that rewriting imports is out of scope for TypeScript and will not be implemented.
Has this stance changed in light of the newly added TypeScript support in Nodejs?
I am aware that the support status is experimental so Nodejs will make changes before it rolls out generally but it looks like this particular decision is not likely to change