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

Google feedback on TS 4.6-beta #47908

Closed
rishipal opened this issue Feb 15, 2022 · 0 comments
Closed

Google feedback on TS 4.6-beta #47908

rishipal opened this issue Feb 15, 2022 · 0 comments
Labels
Discussion Issues which may not have code impact

Comments

@rishipal
Copy link

This GitHub issue contains feedback on the TS 4.6-beta release from the team
that is responsible for keeping Google's internal software working with the
latest version of TypeScript.

Executive summary

  • Some changes to our TypeScript code are required to make it compile with TS
    4.6.
  • Detail sections below explain the changes to our code we expect to make to
    unblock the upgrade.

Impact summary

Change description Announced Libraries affected
lib/d.ts Changes no 0.0357%
Object Rests Drop Unspreadable Members from Generic Objects yes 0.0011%
Syntax and Binding Errors in JavaScript - 0.000%
Unclassified - 0.037%

The Announced column indicates whether we were able to connect the observed
change with a section in the
TS4.6-beta announcement.

The following sections give more detailed explanations of the changes listed
above.

Changes which were announced

lib/d.ts Changes

This change was not announced but also expected.

We support the typing improvements. Generally it's clear what's changing.

Our fix will be inserting type casts to silence the errors in existing code.

We observed the following breakdown within this category:

  • AriaMixin interface properties made nullable: 88.09%
  • 'VisibilityState' (got renamed to 'DocumentVisibilityState'): 7.14%
  • Stricter type of 'StructuredSerializeOptions' interface property: 0.79%
  • 'NumberFormatOptions' removes the 'currencyDisplay' property: 0.79%
  • Stricter type of 'CanvasCompositing' interface property: 3.17%

Object Rests Drop Unspreadable Members from Generic Objects

Dropping unspreadable members breaks code in google which destructures this.

When destructuring this using a ...rest element, unspreadable and non-public
members are now dropped. This causes breakages in google where the rest element
is being cast because neither type sufficiently overlaps with the other.

Example breakage:

  override getTabModelState(): TabModel {
    const {resultsObs, ...tab} = this;
    return tab as TabModel;
  }

We may potentially fix this by changing user code or work around by casting to
unknown first.

Syntax and Binding Errors in JavaScript

Google did not have any JavaScript failures related to the new JavaScript syntax
and binding errors, because our build infrastructure is configured such that it
does not pass JavaScript files through TypeScript.

Changes that are skipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Issues which may not have code impact
Projects
None yet
Development

No branches or pull requests

2 participants