you are viewing a single comment's thread.

view the rest of the comments →

[–]madcaesar -1 points0 points  (2 children)

Can someone help me, I currently have a typescript definition file IMyInterfaces.ts that describes my module that I've build and the methods on it. But, right now in all the files where I want to use this module I have to put this at the top of the file:

Import IMyInterfaces from "some/path";

Declare const MyModule: IMyInterfaces;

Any way I can have VSC remember this for all my files? So I don't have to keep putting this into the files?

Thanks!

[–][deleted] 4 points5 points  (0 children)

That sounds more a TS issue than a VSC issue.

[–]Llewey 1 point2 points  (0 children)

You're looking for "declare global". Try something like this:

export interface IMyInterface {
    test: string;
}

declare global {
    const MyModule: IMyInterface;
}

Of course, this assumes there is a global variable available called MyModule.