Global type not recognized in files excluded from compilation

I have global type defined in global.d.ts

type Id = string;

It gets recognized in files included for tsc build.

However it's not recognized by WebStorm IDE (TS2304: Cannot find name 'Id'.) in files excluded from tsc compilation, e.g. test files running with ts-node (without any issues btw.).

0
2 comments

Running tsc in terminal gives the same error, and the other editors (VSCode) show it as well:

0

Solved with dedicated tsconfig.json placed in test directory:

{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"files": [
"../global.d.ts"
],
"include": [
"**/*.ts"
],
"exclude": []
}
2

Please sign in to leave a comment.