You can find the complete NPM package on GitHub here.
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs"
}
}
global.d.ts
interface Foo { }
index.ts
const x: Foo = {};
When we try to build, we encounter this error:
$ \node_modules\.bin\tsc .\index.ts
index.ts(1,10): error TS2304: Cannot find name 'Foo'.
The version we are using is:
$ .\node_modules\.bin\tsc --version
Version 2.3.4
These are the files listed by tsc:
$ .\node_modules\.bin\tsc --listFiles
C:/temp/node_modules/typescript/lib/lib.d.ts
C:/temp/global.d.ts
C:/temp/index.ts
In order to automatically load Foo
into the index.ts file, how can we achieve this?
Research
The documentation on global.d.ts suggests that the above setup should work as intended.