Home > Net >  Global window object: Element implicitly has an 'any' type because index expression is not
Global window object: Element implicitly has an 'any' type because index expression is not

Time:04-02

I am getting the error below with window declared in our TypeScript file. How can I fix this?

const { TestFrame } = window['sisense.embed'];

Element implicitly has an 'any' type because index expression is not of type 'number'.ts(7015)

CodePudding user response:

If you have defined sisense.embed on the global window object, then you could ignore the error with:

const { TestFrame } = (window as any)['sisense.embed'];

See: How do you explicitly set a new property on window in TypeScript?

  • Related