Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] 🔥 TS types analytics Item reject undefined fields #8370

Open
2 of 10 tasks
alpha0010 opened this issue Feb 24, 2025 · 0 comments
Open
2 of 10 tasks

[🐛] 🔥 TS types analytics Item reject undefined fields #8370

alpha0010 opened this issue Feb 24, 2025 · 0 comments
Labels
Needs Attention plugin: analytics Google Analytics for Firebase type: bug New bug report

Comments

@alpha0010
Copy link

Issue

After upgrading to 21.11.0, I got the TS error from my existing code:

Type '{ item_id: string; item_name: string; item_variant: string | undefined; }' is not assignable to type 'Item'.
  Property 'item_variant' is incompatible with index signature.
    Type 'string | undefined' is not assignable to type 'string | number'.
      Type 'undefined' is not assignable to type 'string | number'.

This appears to be due to #7908 , meaning any provided Item fields are no longer allowed to be assigned undefined. Specifically, the variable I am assigning to item_variant has the type string | undefined (in my code).

Now, I could work around this by making a big conditional builder to only assign fields for which I have data, but that would make my code a lot messier/verbose. Is this change intentional?


Project Files

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 System:
  OS: macOS 15.3.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 86.42 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.5.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.08.05.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.11
    wanted: 0.73.11
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 21.11.0
  • Firebase module(s) you're using that has the issue:
    • Analytics
  • Are you using TypeScript?
    • Y & 5.0.4


@MichaelVerdon MichaelVerdon added the plugin: analytics Google Analytics for Firebase label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention plugin: analytics Google Analytics for Firebase type: bug New bug report
Projects
None yet
Development

No branches or pull requests

2 participants