0

Imagine I have a class

export class Foo
{
   methodX():string
   {
   }
}

window.foo = new Foo();

and I have my window interface what is the workaround to add Foo in window interface

interface Window {
    foo:Foo;
}

this is working for internal modules but not for external modules.

1 Answer 1

1

You cannot use ambient interfaces in internal modules, so declare interface in separate file:

interface IFoo {
    methodX(): string;
}

interface Window {
    foo: IFoo;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.