Skip to content

Interface 'FirebaseServerAppSettings' incorrectly extends interface 'FirebaseAppSettings' when "exactOptionalPropertyTypes": true is enabled #8227

Closed
@dckz74

Description

@dckz74

Operating System

macOS Sonoma 14.4.1

Browser Version

Chrome/124.0.6367.119

Firebase SDK Version

10.11.1

Firebase SDK Product:

Analytics, Auth, Component, Installations, Logger

Describe your project's tooling

Vue3 app with Vite and Jest

Describe the problem

I'm encountering a TypeScript compilation error involving FirebaseServerAppSettings when "exactOptionalPropertyTypes": true is set in my tsconfig.json. This is the error message:

error TS2430: Interface 'FirebaseServerAppSettings' incorrectly extends interface 'FirebaseAppSettings'.
  Types of property 'name' are incompatible.
    Type 'undefined' is not assignable to type 'string'.

If I set "exactOptionalPropertyTypes" to false it works.
Here you can see both interfaces:

export declare interface FirebaseAppSettings {
    name?: string;
    automaticDataCollectionEnabled?: boolean;
}
export declare interface FirebaseServerAppSettings extends FirebaseAppSettings {
    authIdToken?: string;
    releaseOnDeref?: object;
    name?: undefined;
}

Steps and code to reproduce issue

  1. In your TypeScript project, set "exactOptionalPropertyTypes": true in tsconfig.json.
  2. Execute vite build to build the project.

Activity

added
newA new issue that hasn't be categoirzed as question, bug or feature request
on May 7, 2024
google-oss-bot

google-oss-bot commented on May 7, 2024

@google-oss-bot
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

added and removed
newA new issue that hasn't be categoirzed as question, bug or feature request
on May 7, 2024
dlarocque

dlarocque commented on May 7, 2024

@dlarocque
Contributor

Hi @dckz74, I was not able to reproduce the issue. I attempted to reproduce the issue with the following steps:

  1. npm create vite@latest
  2. cd vite-app
  3. yarn install && yarn install firebase
  4. Modify src/main.ts to be the following
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { initializeApp } from 'firebase/app';

const firebaseConfig = { 
    // My config (omitted)
};

initializeApp(firebaseConfig);
createApp(App).mount('#app')
  1. Add "exactOptionalPropertyTypes": true to tsconfig.json
  2. Run npx vite build

This was the output from the build

$ npx vite build
vite v5.2.11 building for production...
✓ 25 modules transformed.
dist/index.html                  0.46 kB │ gzip:  0.30 kB
dist/assets/index-B87vROlf.css   1.27 kB │ gzip:  0.65 kB
dist/assets/index-Cmnve67z.js   90.79 kB │ gzip: 30.66 kB
✓ built in 355ms

To help me reproduce the issue, could you provide a code snippet that causes the issue to occur, or a minimal project I can clone to reproduce the issue?

dckz74

dckz74 commented on May 8, 2024

@dckz74
Author

Hey @dlarocque, thanks for your quick response!

You are right, this does not reproduce the issue, my bad. Unfortunately, I am currently not able to give you a minimal project to reproduce this issue.

I will need to look deeper into my code base to see why the issue occurs.
Thank you for your time!

dlarocque

dlarocque commented on May 8, 2024

@dlarocque
Contributor

Hey @dlarocque, thanks for your quick response!

You are right, this does not reproduce the issue, my bad. Unfortunately, I am currently not able to give you a minimal project to reproduce this issue.

I will need to look deeper into my code base to see why the issue occurs. Thank you for your time!

No worries! Please let us know when you are able to share more information that could help us identify the issue.

google-oss-bot

google-oss-bot commented on May 15, 2024

@google-oss-bot
Contributor

Hey @dckz74. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot

google-oss-bot commented on May 22, 2024

@google-oss-bot
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@dckz74 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

locked and limited conversation to collaborators on Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dckz74@google-oss-bot@dlarocque@jbalidiong

        Issue actions

          Interface 'FirebaseServerAppSettings' incorrectly extends interface 'FirebaseAppSettings' when "exactOptionalPropertyTypes": true is enabled · Issue #8227 · firebase/firebase-js-sdk