on-internet
← Community

Typescript ESLint declaration files

Stack Overflow ·

I've googled around a bit but I can't find anything regarding this, might be because I'm not exactly sure what causing the issue. I wanted to set a global value on the node.js global object. Just a simple string global.appRoot = path.resolve(__dirname) Since I'm using Typescript, my editor (Visual Studio Code) warned me that the property did not exist on type Global which makes sense. I went ahead and created a global.d.ts in my root folder with declare namespace NodeJS { export interface Global { appRoot: string; } } This worked perfectly and the editor tells me it's fine, but still breaks on

Comments

Sign in or sign up to comment and upvote.

No comments yet.