Skip to content

Google feedback on TS 4.6-beta #47908

Closed
Closed
@rishipal

Description

@rishipal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionIssues which may not have code impact

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions