-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Google feedback on TS 4.2-beta #42593
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
Comments
I have not yet read this in full, but thank you all tremendously for the summary on 4.2 which we find invaluable. We have second guessed the template literal inference changes in 4.2 quite a bit for the last few weeks, and we have a revert out for review here: #42588 |
Just a small side-note: Your seemingly arbitrary use of linebreaks in the middle of sentences makes reading this issue very difficult. |
I think this is an unfortunate part of GitHub's commenting system, which uses a different markdown parsing strategy from its doc system. When writing markdown, I use one line per sentence. In the write-up @nreid260 had, there seems to be an auto-wrapping strategy. So where most markdown document parsers interpret these as part of the same paragraph, GitHub's comment parser kicks separate lines onto...separate lines, and makes our text look sub-optimal. |
RE: linebreaks, this summary was written first as an internal PR and so got formatted using our Markdown formatter |
For what it's worth, I also really enjoy these because it shows me holes in the breaking change section of our release notes. For example, I will be adding in the |
For 4.2-rc we observed the following:
|
Since you'd mentioned 50% of breaks being related to Intl - I should mention some of those have been reverted as well. You may need to deal with the removal of certain type aliases that'd been introduced for 4.2, but backed out post-RC. |
Thanks for the warning. I think we won't adapt our code to the TS releases until they are final (and maybe sometimes even after a few point releases in some cases), in part because it takes us a while to catch up, but also so we can avoid some of the churn that inevitably happens. |
Are you saying that this time it was so bad that you are stopping, or that you only determined the root cause of the breaks for Beta and RC and didn't try fixing them until stable? We really appreciate you all trying these early! |
The latter! It takes us a while to adopt a version due to the work involved, so we are still slow. For example, we just rolled out 4.1 recently. In other words, we are trying to provide feedback on the betas so the feedback comes in early enough to be able to fix any big problems before they're released, but in terms of actually deploying those eventual releases we are likely ~months behind. |
This GitHub issue contains feedback on the TS 4.2-beta release from the team
that is responsible for keeping Google's internal software working with the
latest version of TypeScript.
Executive summary
4.2.
tool's output in some cases. We will fix the tools to match the new
behavior.
4.2.
related to announced changes.
errors that were previously missed by TS 4.1.
to unblock the upgrade.
Impact summary
.d.ts
Extension Breaks Module ResolutionnoImplicitAny
inyield
in
RHSabstract
Construct SignaturesThe Announced column indicates whether we were able to connect the observed
change with a section in the
TS4.2-beta announcement.
The following sections give more detailed explanations of the changes listed
above.
Template Literal Types
This change was announced.
We find the typing of template literals questionable, since it leads to
unexpected inference and spammy error messages. It's also unclear what the
application of these types is.
Example:
In this case, a template literal type was inferred for a local variable. The
diagnostic is emitted at a reassignment to that variable. The user clearly
intended type
string
. Several more verbose examples were found.Our fix for the new type errors will likely be casting to
string
..d.ts Extension Breaks Module Resolution
This change was not announced.
Starting with TS 4.2 the filename extension must not be included in the import
statement. The module resolution algorithm expects to add '.d.ts' itself.
The issue on our side was that other tools in our toolchain (tsickle and Clutz)
were generating import statements that included .d.ts extensions. These imports
began failing across our codebase such that many types were unavailable and
those libraries had type errors. There was no obvious connection of module
resolution issues.
We have since updated our tools to omit file extensions. These imports also work
against 4.1, so we don't anticipate further issues, regardless of whether this
makes it into 4.2.
Changes to lib.d.ts Definitions
This change was not announced but also expected.
We support the typing improvements. Generally it's clear what's changing.
Our fix will likely be casting away the errors in existing code.
We observed the following breakdown within this category:
Typechecking Stack Depth Increased
This change was not announced but isn't an API change.
Our fix will likely be to replace some complex types with simpler ones and
accept some losses in type accuracy.
A handful of libraries in our codebase use types that are arguably too complex.
The power of the TS typesystem allows this, but can lead to runaway typing.
A sample stack trace is below:
The text was updated successfully, but these errors were encountered: