-
Notifications
You must be signed in to change notification settings - Fork 962
Closed
Description
Operating System
macOS 14.4.1
Browser Version
N/A
Firebase SDK Version
10.11.1
Firebase SDK Product:
Auth, Database
Describe your project's tooling
[email protected] and [email protected] (both with PnP and node-modules as linkers). We use firebase within a Chrome extension we ship.
Describe the problem
After upgrading to Firebase 10.11.1, and adding an import to the new firebase/auth/web-extension
, we're seeing TypeScript's tsc
failing.
$ yarn tsc
.yarn/__virtual__/@firebase-auth-virtual-71e7d0bce6/2/.yarn/berry/cache/@firebase-auth-npm-1.7.2-ae578599ac-10c0.zip/node_modules/@firebase/auth/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts:17:10 - error TS2305: Module '"@firebase/app"' has no exported member '_FirebaseService'.
17 import { _FirebaseService, FirebaseApp } from '@firebase/app';
~~~~~~~~~~~~~~~~
.yarn/__virtual__/@firebase-auth-virtual-71e7d0bce6/2/.yarn/berry/cache/@firebase-auth-npm-1.7.2-ae578599ac-10c0.zip/node_modules/@firebase/auth/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts:19:47 - error TS2307: Cannot find module '@firebase/app-check-interop-types' or its corresponding type declarations.
19 import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.yarn/__virtual__/@firebase-auth-virtual-71e7d0bce6/2/.yarn/berry/cache/@firebase-auth-npm-1.7.2-ae578599ac-10c0.zip/node_modules/@firebase/auth/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts:65:70 - error TS2344: Type '"heartbeat"' does not satisfy the constraint '"auth"'.
65 constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>, appCheckServiceProvider: Provider<AppCheckInternalComponentName>, config: ConfigInternal);
~~~~~~~~~~~
.yarn/__virtual__/@firebase-auth-virtual-71e7d0bce6/2/.yarn/berry/cache/@firebase-auth-npm-1.7.2-ae578599ac-10c0.zip/node_modules/@firebase/auth/dist/web-extension-esm2017/src/model/popup_redirect.d.ts:30:40 - error TS2503: Cannot find namespace 'gapi'.
30 export interface GapiAuthEvent extends gapi.iframes.Message {
Steps and code to reproduce issue
- Clone https://github.com/wegry/broken-firebase-web-extension-types
yarn
yarn tsc
More context
Locally, we can sort of hedge around this with some module augmentations, but it'd be nice to not have to do this.
// shimFirebaseTypes.ts
/** @deprecated don't use this. It's to fix broken {@firebase/auth} types. */
declare module '@firebase/auth/dist/web-extension-esm2017/src/model/popup_redirect.d.ts' {
// eslint-disable-next-line @typescript-eslint/no-namespace -- we're overriding a broken module type here.
namespace gapi {
// eslint-disable-next-line @typescript-eslint/no-namespace -- we're overriding a broken module type here.
namespace iframes {
export class Message {}
}
}
}
declare module '@firebase/app' {
export class _FirebaseService {}
}
declare module '@firebase/auth/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts' {}
declare module '@firebase/component' {
export type Provider = any;
export interface NameServiceMapping {
['app-check-internal']: any;
heartbeat: any;
}
}