You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--experimental-strip-types does not work for STDIN #54035
hello
(node:9012) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8861) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[stdin]:1
const greeting: string = "hello"; console.log(greeting);
^^^^^^^^
SyntaxError: Missing initializer in const declaration
at makeContextifyScript (node:internal/vm:185:14)
at node:internal/process/execution:107:22
at [stdin]-wrapper:6:24
at runScript (node:internal/process/execution:101:62)
at evalScript (node:internal/process/execution:136:3)
at node:internal/main/eval_stdin:32:5
at Socket.<anonymous> (node:internal/process/execution:237:5)
at Socket.emit (node:events:532:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v23.0.0-nightly202407253de7a4c374
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Per the docs, the expected behaviour is that --eval and STDIN are both supported:
Type stripping can be enabled for --eval and STDIN input. The module system will be determined by --input-type, as it is for JavaScript.
What do you see instead?
Instead we receive an error as if we had not passed the flag --experimental-strip-types.
It is clear from the (red) stderr that the flag was acknowledged by node.
Additional information
I wasn't sure from the docs if --input-type should be passed, but the CLI feedback is that only values of "module" or "commonjs" would work, and neither helped.
Activity
marco-ippolito commentedon Jul 25, 2024
So STDIN input was never meant to be supported, except eval, I guess its just a documentation issue.
doc: correct typescript stdin support
tchetwin commentedon Jul 25, 2024
Thanks!
doc: correct typescript stdin support
doc: correct typescript stdin support