'How can I import a type declaration from another folder?
I want to separate my type declarations into separate folders like:
/types/index.d.ts
/types/express/index.d.ts
However, I lose the typings if I move the type definitions for express out of the root /types/index.d.ts file and import from a folder.
/types/index.ts
import './express'
/types/express/index.d.ts
// what do I export?
declare global { // is this correct?
namespace Express {
export interface Request {
user: User & {
id: string;
};
}
export interface Response {
clearAuthCookie: () => this;
}
}
}}
My ts.config:
...
"typeRoots": ["node_modules/@types", "types"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
