Is there a way to make a file in your typescript file that defines globally accessible types?
I like typescript but find that when i want to be truly type safe I hav
A little late but, you can add a file.d.ts anywhere in your project as I've noticed, and it will be picked up.
For example, in my project I wanted a:
Optional = T | null;
And I didn't know where to add it, so I added a common.d.ts in a folder, and added:
declare type Optional = T | null;
Now it's being picked up and no errors. Didn't even need to import it. This of course being tested in vscode, not sure if it will work in your editor.
(Depending on your file include/exclude rules of course, but most projects include all *.ts)