TypeScript error: Property 'FIREBASE_APPCHECK_DEBUG_TOKEN' does not exist on type 'Window & typeof globalThis' (TS2339)

Viewed 157

I have setup App Check on my Vue / Firebase app.

To enable local development with App Check I am following the intructions here.

And those instructions ask you to set a debug token like so:

self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;
initializeAppCheck(app, { /* App Check options */ });

But my app is written in TypeScript and it gives me this TypeScript error:

TS2339: Property 'FIREBASE_APPCHECK_DEBUG_TOKEN' does not exist on type 'Window & typeof globalThis'.

How to resolve this?

1 Answers

I had to declare a global to get this working:

declare global {
  // eslint-disable-next-line no-var
  var FIREBASE_APPCHECK_DEBUG_TOKEN: boolean | string | undefined;
}
Related