I've installed @types/node and ts2 beta (locally and globally)
If I do tsc path/to/file.ts (or node ./node_modules/typescript/bin/tsc path/to/file.ts) it compiles ok, so no need in placing path to node typings in files. But ts-node requires it.
I use ts-node using register hook and can not find typings for node while run. So I have to place: "node_modules/@types/node/index.d.ts" in files of tsconfig.json and then it works.
Is it expected? Why it should it be configured this way?
Can you provide the versions you're using?
That would be why. You need to update.
This is the PR (https://github.com/TypeStrong/ts-node/pull/150) that should have enabled support. Let me know if that fixes things for you.
Here's a related issue also: https://github.com/TypeStrong/ts-node/issues/153.
Seems the issue persist with 1.3.0, in tsconfig I only have exclude (or files).
@whitecolor Are you using Windows? Could be the same issue as https://github.com/TypeStrong/ts-node/issues/168 - I haven't resolved that yet.
Yes i'm using windows, ts-node doesn't lookup typings in node_modules/@types (the same problem I experience with webpack's ts-loader)
It works on Unix as far as I know, so it's not that.
Hello, Windows 10 64 bit here. Using typescript 2.0.3 and ts-node 1.3.0
I got this working by using the types key under compilerOptions in tsconfig.json
Here is an example tsconfig.json I'm using to run mocha tests via npm with the following script: "mocha --compilers ts:ts-node/register,tsx:ts-node/register \"./src/**/*.spec.ts\""
{
"compilerOptions": {
...
"types": [
"node",
"mocha",
"chai",
...
]
},
"include": [
"./src/**/*.ts",
"./src/**/*.tsx"
],
"exclude": [
"node_modules",
"./src/**/*.spec.ts"
]
}
I got this working by using the types key under compilerOptions in tsconfig.json
That works.
Most helpful comment
Hello, Windows 10 64 bit here. Using typescript 2.0.3 and ts-node 1.3.0
I got this working by using the
typeskey undercompilerOptionsintsconfig.jsonHere is an example tsconfig.json I'm using to run mocha tests via npm with the following script:
"mocha --compilers ts:ts-node/register,tsx:ts-node/register \"./src/**/*.spec.ts\""