Skip to content

Update error handling for TS v4.4 unknown variables #6362

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

Merged
merged 1 commit into from
Jun 15, 2022
Merged

Conversation

dwyfrequency
Copy link
Contributor

Updating error handling in select packages to account for a future TypeScript package upgrade. For more information, see the below blog comment about TypeScript v4.4 errors.

"""
In JavaScript, any type of value can be thrown with throw and caught in a catch clause. Because of this, TypeScript historically typed catch clause variables as any, and would not allow any other type annotation:

Once TypeScript added the unknown type, it became clear that unknown was a better choice than any in catch clause variables for users who want the highest degree of correctness and type-safety, since it narrows better and forces us to test against arbitrary values. Eventually TypeScript 4.0 allowed users to specify an explicit type annotation of unknown (or any) on each catch clause variable so that we could opt into stricter types on a case-by-case basis; however, for some, manually specifying : unknown on every catch clause was a chore.
"""
per https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#use-unknown-catch-variables

@changeset-bot
Copy link

changeset-bot bot commented Jun 15, 2022

⚠️ No Changeset found

Latest commit: 3bf1aaa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (b091b02)Merge (615acb4)Diff
    browser262 kB262 kB+54 B (+0.0%)
    esm5325 kB325 kB+52 B (+0.0%)
    main521 kB521 kB+84 B (+0.0%)
    module262 kB262 kB+54 B (+0.0%)
    react-native262 kB262 kB+54 B (+0.0%)
  • @firebase/messaging

    TypeBase (b091b02)Merge (615acb4)Diff
    browser21.2 kB21.3 kB+106 B (+0.5%)
    esm526.5 kB26.6 kB+106 B (+0.4%)
    main27.2 kB27.3 kB+106 B (+0.4%)
    module21.2 kB21.3 kB+106 B (+0.5%)
  • @firebase/messaging-sw

    TypeBase (b091b02)Merge (615acb4)Diff
    main29.9 kB30.0 kB+106 B (+0.4%)
    module23.2 kB23.3 kB+106 B (+0.5%)
  • bundle

    TypeBase (b091b02)Merge (615acb4)Diff
    firestore (Persistence)273 kB273 kB+14 B (+0.0%)
    messaging (send + receive)45.0 kB45.1 kB+98 B (+0.2%)
  • firebase

    TypeBase (b091b02)Merge (615acb4)Diff
    firebase-compat.js793 kB793 kB+170 B (+0.0%)
    firebase-firestore-compat.js314 kB314 kB+14 B (+0.0%)
    firebase-firestore-lite.js845 kB845 kB+109 B (+0.0%)
    firebase-firestore.js845 kB845 kB+109 B (+0.0%)
    firebase-messaging-compat.js38.0 kB38.1 kB+156 B (+0.4%)
    firebase-messaging-sw.js107 kB107 kB+142 B (+0.1%)
    firebase-messaging.js106 kB106 kB+142 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/JZ5nlWOtNy.html

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • _setIndexConfiguration

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size24.3 kB24.4 kB+40 B (+0.2%)
      size-with-ext-deps83.8 kB83.8 kB+40 B (+0.0%)
    • clearIndexedDbPersistence

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size24.9 kB24.9 kB+4 B (+0.0%)
      size-with-ext-deps84.5 kB84.5 kB+4 B (+0.0%)
    • enableIndexedDbPersistence

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size174 kB174 kB+14 B (+0.0%)
      size-with-ext-deps235 kB235 kB+14 B (+0.0%)
    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size206 kB206 kB+14 B (+0.0%)
      size-with-ext-deps267 kB267 kB+14 B (+0.0%)
  • @firebase/messaging

    • deleteToken

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size12.6 kB12.7 kB+98 B (+0.8%)
      size-with-ext-deps38.1 kB38.2 kB+98 B (+0.3%)
    • getMessaging

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size13.0 kB13.1 kB+98 B (+0.8%)
      size-with-ext-deps38.7 kB38.8 kB+98 B (+0.3%)
    • getToken

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size12.5 kB12.6 kB+98 B (+0.8%)
      size-with-ext-deps38.0 kB38.1 kB+98 B (+0.3%)
    • isSupported

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size12.8 kB12.9 kB+98 B (+0.8%)
      size-with-ext-deps38.3 kB38.4 kB+98 B (+0.3%)
    • onMessage

      Size

      TypeBase (b091b02)Merge (615acb4)Diff
      size12.6 kB12.7 kB+98 B (+0.8%)
      size-with-ext-deps38.1 kB38.2 kB+98 B (+0.3%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/jjYatds3pl.html

@dwyfrequency dwyfrequency marked this pull request as ready for review June 15, 2022 21:04
@dwyfrequency dwyfrequency requested a review from zwu52 as a code owner June 15, 2022 21:04
@dwyfrequency dwyfrequency requested a review from hsubox76 June 15, 2022 21:04
@dwyfrequency dwyfrequency merged commit 8e952e2 into master Jun 15, 2022
@dwyfrequency dwyfrequency deleted the typing branch June 15, 2022 21:26
@firebase firebase locked and limited conversation to collaborators Jul 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants