Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'analytics' does not exist on type 'Window & typeof globalThis'. #4

Open
Carl-Meyer opened this issue May 20, 2020 · 4 comments

Comments

@Carl-Meyer
Copy link

When running ng test I get the following error on all of my spec tests:

Property 'analytics' does not exist on type 'Window & typeof globalThis'.

This is strange as I did declare the analytics property as instructed?

declare global { interface Window { analytics: any; } }

@realtysapient
Copy link

Hello all. I'm also hitting: property 'analytics' does not exist on type 'Window'. I also set the declare global { interface Window { analytics: any; } }. Any ideas? Thanks in advance!

@benjaminhoffman
Copy link

benjaminhoffman commented Oct 12, 2021

@Carl-Meyer @realtysapient try adding the keyword export, as in:

/* eslint-disable */
export declare global {
  interface Window {
    analytics?: any;
  }
}
/* eslint-enable */

does that work for you? another less ideal situation is to rename your use of window.analytics to globalThis.analytics

@shadyacres
Copy link

@benjaminhoffman this doesn't work for me, and also causes another problem:
'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.

@CarlosDevSanchez07
Copy link

El tipo de archivo debe ser .d.ts para evitar el error de export.

@benjaminhoffman this doesn't work for me, and also causes another problem: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants