-
-
Notifications
You must be signed in to change notification settings - Fork 35.1k
Closed as not planned
Closed as not planned
Copy link
Description
Version
v22.14.0
Platform
Darwin 192.168.88.98 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
echo "import 'node:console'" > file.ts
node file.tsHow often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
Support is documented here https://nodejs.org/api/typescript.html#type-stripping
What do you see instead?
node:internal/modules/esm/get_format:219
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for ~/file.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:219:9)
at defaultGetFormat (node:internal/modules/esm/get_format:245:36)
at defaultLoad (node:internal/modules/esm/load:120:22)
at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:514:32)
at async ModuleJob._link (node:internal/modules/esm/module_job:115:19) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Node.js v22.14.0
Additional information
Feels like I'm missing something. Why does this not work? This also fails
$ echo "console.log(1 as number)" > file.ts
$ node file.ts --experimental-strip-types
SyntaxError: missing ) after argument list
This fails regardless of tsconfig presence
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels