i have a custom type called JWTSubject
and when trying to compile i get this error
error TS2304: Cannot find name 'JWTSubject'
my tsconfig.json
looks like so;
{
"compilerOptions": {
"target": "es2016" ,
"module": "commonjs" ,
"rootDir": "./src" ,
"typeRoots": [
"./@types",
"./node_modules/@types"
] ,
"outDir": "./dist" ,
"removeComments": true ,
"esModuleInterop": true ,
"forceConsistentCasingInFileNames": true ,
"strict": true,
"skipLibCheck": true,
},
"include": ["./src", "./@types"],
"exclude": [".git", "node_modules"]
}
my file structure looks like so;
├───src
│
├───@types├── global.d.ts
│ │
│ └── custom ── index.d.ts
│
├───tsconfig.json
│
global.d.ts looks like ;
import IUser from "../src/interfaces/IUser";
declare global {
export type JWTSubject = {
_id: IUser["_id"];
username: IUser["username"];
};
}