Skip to content

Missing usePublicVapidKey in firebase.messaging when import from firebase/app module #628

Closed
@6r1anchen

Description

@6r1anchen

[REQUIRED] Describe your environment

  • Operating System version: macOS 10.13.4
  • Firebase SDK version: 4.12.1
  • Firebase Product: messaging

[REQUIRED] Describe the problem

Steps to reproduce:

  1. yarn install firebase
  2. Import core module firebase/app and optional firebase/messaging in ts file
  3. Try to use usePublicVapidKey method of firebase.messaging.Messaging
  4. Get tsc(v2.4.2) error message:
    Property 'usePublicVapidKey' does not exist on type 'Messaging'.

If I changed to import * as firebase from 'firebase', then it will use firebase/index.d.ts, which includes usePublicVapidKey under Messaging interface.
I was trying to follow the documentation from here to only include necessary service module from firebase.
Is the documentation update to date in this case?

Relevant Code:

import * as firebase from 'firebase/app';
import 'firebase/messaging';

firebase.initializeApp({});
const messaging = firebase.messaging();
messaging.usePublicVapidKey("key");

There is no usePublicVapidKey defined in firebase/app/index.d.ts

Related to #562 and PR #563

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions