firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Compilation Error with Typescript when enabling "exactOptionalPropertyTypes"

Open ansf opened this issue 1 year ago • 2 comments

Operating System

macOS 14

Browser Version

Chrome 126

Firebase SDK Version

10.12.2

Firebase SDK Product:

Analytics

Describe your project's tooling

typescript project, with "exactOptionalPropertyTypes" enabled in tsconfig.json.

Describe the problem

The project does not compile and gives the following error:

node_modules/@firebase/app/dist/app-public.d.ts:201:26 - error TS2430: Interface 'FirebaseServerAppSettings' incorrectly extends interface 'FirebaseAppSettings'.
  Types of property 'name' are incompatible.
    Type 'undefined' is not assignable to type 'string'.

201 export declare interface FirebaseServerAppSettings extends FirebaseAppSettings {

With exactOptionalPropertyTypes the both declarations of name are not compatible (see https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes).

This is actually a duplicate of #8227, but I was unable to comment on the original issue and wanted to provide a minimal reproducible example (see below)

Steps and code to reproduce issue

  1. Checkout https://github.com/ansf/firebase-8227-mre
  2. npm i
  3. npm run compile

ansf avatar Jun 26 '24 05:06 ansf

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

google-oss-bot avatar Jun 26 '24 05:06 google-oss-bot

Hi @ansf, thanks for reaching out to us. I was able to reproduce the error using your code. I'll communicate this with our engineers and bring someone here that can provide more context about it. I’ll update this thread if I have any information to share.

jbalidiong avatar Jun 27 '24 10:06 jbalidiong

This fix should go out in our next release!

DellaBitta avatar Jul 01 '24 22:07 DellaBitta