I have created some custom Typescript declarations in a custom.d.ts
file. When I have this file opened in VS Code, everything works correctly and the types are recognized. However, when I close the file, VS Code does not recognize these definitions, leading to red error underlines throughout my code.
The issue is that my tsconfig.json
file is not located in the root directory, neither is my custom.d.ts
file. I find it frustrating that config files must be placed in the root directory, why can't they go into a designated config folder?
How can I make sure that VS Code acknowledges my custom.d.ts
file even when it's closed? As mentioned before, having the file open resolves the issue, but as soon as it's closed, the type definitions are no longer recognized, resulting in errors.
Directory Structure:
/
| - package.json
| - .gitignore
| - client/
| - client source code....
| - server/
| - @types/
| - custom.d.ts
| - configs/
| - tsconfig.json
| - .develop.env