I'm migrating a legacy codebase to Typescript & it has some global objects attached to window
& I want these to be available always.
So I created globals.d.ts
file that looks something like this
interface Foo {
a: string;
b: number;
}
interface Bar {
c: string;
d: Array<string>
}
declare global {
interface Window {
foo: Foo;
bar: Bar;
}
}
and I tried all of these variations in tsconfig.json
{
"extends": "some-config",
"include": ["./path/to/types/folder/**"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src": ["./src"],
}
}
}
{
"extends": "some-config",
"files": ["./path/to/globals.d.ts"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src": ["./src"],
}
}
}
{
"extends": "some-config",
"compilerOptions": {
"typeRoots": ["node_modules/@types", "./path/to/types/folder"]
"baseUrl": ".",
"paths": {
"src": ["./src"],
}
}
}
None of these worked...