I’ve noticed that the types.d.ts
file in the root of the project was automatically included in every TypeScript file in my project. I didn’t have to write import type {...} from "./types.d.ts";
in every file manually, which is a very convenient feature.
But recently, that stopped being the case. VSCode shows errors when not writing the line above. What did I do? Could it be something with my tsconfig.json
? More importantly, how do I get it back?
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"*": [
"./node_modules/*"
]
},
"types": ["./types.d.ts"],
"rewriteRelativeImportExtensions": true
}
}
I manually included .ts
extensions in import modules because at first I used tsc
, which outputted the built files in the same place as the normal files, but that’s beyond the scope of my question.
Also, I have not tried compiling without the ./types.d.ts
import. The problem I have as of now is with VSCode.
Extra context: I can’t provide types.d.ts
because of privacy reasons, but I do have one import in it:
import { CacheType, ChatInputCommandInteraction } from "discord.js/typings";