-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[BUG] babel-node does not transform TypeScript source. #6353
Copy link
Copy link
Closed
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
As the title says, currently babel-node does not appear to transform TypeScript source. I did not find any CLI options related to this either, so expected it to work out of the box.
cc @Andy-MS
Input Code
interface SomeTSInterface {
foo: string
}
const x: SomeTSInterface = { foo: "bar" }
console.log(x.foo)Babel Configuration (.babelrc, package.json, cli command)
~/t/babel-7 » node --version
v8.4.0
~/t/babel-7 » ./node_modules/.bin/babel --version
7.0.0-beta.2 (babel-core 7.0.0-beta.2)
~/t/babel-7 » ./node_modules/.bin/babel-node --version
7.0.0-beta.2
Expected Behavior
~/t/babel-7 » ./node_modules/.bin/babel --presets typescript index.ts
const x = {
foo: "bar"
};
console.log(x.foo);
~/t/babel-7 » ./node_modules/.bin/babel --presets typescript index.ts | node
bar
Current Behavior
~/t/babel-7 » ./node_modules/.bin/babel-node --presets typescript index.ts
/Users/eloy/tmp/babel-7/index.ts:1
(function (exports, require, module, __filename, __dirname) { interface SomeTSInterface {
^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:537:28)
at Module._extensions..js (module.js:584:10)
at Object.newLoader [as .js] (/Users/eloy/tmp/babel-7/node_modules/pirates/lib/index.js:93:7)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at Object.<anonymous> (/Users/eloy/tmp/babel-7/node_modules/babel-node/lib/_babel-node.js:156:22)
Your Environment
| software | version(s) |
|---|---|
| Babel | 7.0.0-beta.2 |
| node | 8.4.0 |
| npm | 5.3.0 |
| Operating System | Mac OS X 10.12.5 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue