nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
641 stars 98 forks source link

Typescript Error: Type '"<<My VAPID key>>"' is not assignable to type '"<publicVapidKey>" | undefined'. #400

Closed JuanJoseGonGi closed 3 years ago

JuanJoseGonGi commented 3 years ago

Version

@nuxtjs/firebase: 7.1.1 firebase: 8.1.1 nuxt: 2.14.6 @nuxt/typescript-runtime: 2.0.0 @nuxt/types: 2.14.6 @nuxt/typescript-build: 2.0.3

Steps to reproduce

  1. Use nuxt typescript runtime. https://typescript.nuxtjs.org/guide/runtime

  2. Change nuxt.config.js by nuxt.config.ts

  3. Define the nuxt config as image and export it at the bottom image

  4. Add "types": ["@types/node", "@nuxt/types", "@nuxtjs/firebase"] on tsconfig.json file as specified on https://firebase.nuxtjs.org/tutorials/typescript

  5. Set fcmPublicVapidKey value to any string on nuxt.config.ts as shown below. image

What is Expected?

No error

What is actually happening?

Type '"any vapid key"' is not assignable to type '"<publicVapidKey>" | undefined'. Maybe the types are wrong. The following image shows the type definition for fcmPublicVapidKey image

lupas commented 3 years ago

You are completely right!

The fcmPublicVapidKey was in the Firebase Configuration in an earlier version and we moved it to the messaging config, but it seems we forgot to change the types accordingly.

Fixed it with v7.1.2.

Appreciate the well documented issue - thanks a lot again!