singpolyma
singpolyma

Reputation: 11241

How to access something in the global namespace with the same name as something in a module?

For example:

declare function foo(x : string, y : boolean) : string;

module Bar {
    export function foo(x : string) { return ???.foo(x, true); }
}

How can I access the global foo from anywhere inside Bar (where a raw foo reference will implicitly reference Bar.foo)?

Upvotes: 1

Views: 85

Answers (1)

Ryan Cavanaugh
Ryan Cavanaugh

Reputation: 220944

There isn't a good way to do this.

Technically you could write window['foo'], but this will break in runtimes where the global object is not called window.

Upvotes: 3

Related Questions