Title: Google feedback on TS 5.5-beta · Issue #58685 · microsoft/TypeScript · GitHub
Open Graph Title: Google feedback on TS 5.5-beta · Issue #58685 · microsoft/TypeScript
X Title: Google feedback on TS 5.5-beta · Issue #58685 · microsoft/TypeScript
Description: Acknowledgement I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion. Comment This GitHub issue contains feedback on the TS 5.5-beta release from the team that is responsi...
Open Graph Description: Acknowledgement I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion. Comment This GitHub issue contains feedback on the TS 5.5-bet...
X Description: Acknowledgement I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion. Comment This GitHub issue contains feedback on the TS 5.5...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58685
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Google feedback on TS 5.5-beta","articleBody":"### Acknowledgement\n\n- [X] I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.\n\n### Comment\n\nThis GitHub issue contains feedback on the TS 5.5-beta release from the team\r\nthat is responsible for keeping Google's internal software working with the\r\nlatest version of TypeScript.\r\n\r\n## Executive summary\r\n\r\n* We do not expect to have significant difficulty in upgrading Google to TS\r\n 5.5.\r\n* Some changes to our TypeScript code are required to make it compile with TS\r\n 5.5.\r\n* Detail sections below explain the changes to our code we expect to make to\r\n unblock the upgrade.\r\n\r\n## Impact summary\r\n\r\nChange description | Announced | Libraries affected\r\n---------------------------------- | --------: | -----------------:\r\nInferred type predicates | yes | 0.018%\r\nTemplate literal types + enums | no | 0.011%\r\nRegular expression syntax checking | yes | 0.007%\r\nConst indexed accesses | yes | 0.003%\r\nlib/d.ts changes | yes | 0.003%\r\nIsolatedModules string | no | 0.003%\r\n\r\nThe **Announced** column indicates whether we were able to connect the observed\r\nchange with a section in the\r\n[TS5.5-beta announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4-beta/).\r\n\r\nThe following sections give more detailed explanations of the changes listed\r\nabove.\r\n\r\n## Changes which were announced\r\n\r\n### lib/d.ts Changes\r\n\r\nWe support the typing improvements. Generally it's clear what's changing and the\r\nchanges seems minimal this time.\r\n\r\nFor the TSC changes, we expect to fix our codebase to comply to the new API and\r\nfor other typing changes, we expect to `// @ts-ignore` to silence the errors.\r\n\r\n### Inferred type predicates\r\n\r\nhttps://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#inferred-type-predicates\r\n\r\nWe support this change. We expect to `// @ts-ignore` to silence new errors.\r\n\r\nThe only downside is a few targets broken by unwanted narrowing, but we plan to\r\neither suppress with `@ts-ignore` or add an explicit type declaration.\r\n\r\nHere's an example of the kind of working code that broke:\r\n\r\n```ts\r\ndeclare function getFlagsList(): Flag[];\r\ndeclare function shouldAddA(): boolean;\r\nenum Flag {\r\n A,\r\n B,\r\n C\r\n}\r\n// Type changes between 5.4.2 and 5.5-beta.\r\nconst flags = getFlagsList()\r\n .filter((f) => f !== Flag.A);\r\nif (shouldAddA()) {\r\n // Error in 5.5-beta:\r\n // Argument of type 'Flag.A' is not assignable to parameter of type\r\n // 'Flag.B | Flag.C'.\r\n flags.push(Flag.A);\r\n}\r\n```\r\n\r\n### Regular expression syntax checking\r\n\r\nhttps://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#regular-expression-syntax-checking\r\n\r\nWe support this change. Most breakages were due to code using newer syntax\r\nfeatures not transpiled down to older browsers, and we expect to `@ts-ignore`\r\nthe breakages.\r\n\r\n### Control flow narrowing for const indexed accesses\r\n\r\nhttps://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#control-flow-narrowing-for-constant-indexed-accesses\r\n\r\nWe support this change. We expect to `// @ts-ignore` to silence new errors.\r\n\r\n## Other changes\r\n\r\n### Template literal type + enum\r\n\r\nWe noticed a small change in how templatized template literal types interact\r\nwith string enums.\r\n\r\nTS 5.4.2 :\r\n[playground link](https://www.typescriptlang.org/play/?isolatedModules=true&ts=5.4.5#code/FAegVGAEBKCmAOAnWBnWA7ALiymAWskGArgLaQBuAhgDbGED2ikVkKmiAlugOaQDuiKvHiwAJpVr1IDAGa4CRdGQB0kMCGCwAHvCaZcAT1GQAostLiAyh248APABUi2zBjE52XXgD5IAXkgAAwASAG9HAF8ggG5gLQtIADEGBkgw4EhIAA0AyABybXyAGkzIAE08-MN84EjgIKDgAGMGdHZIbQAuMwtrW157FIY-QOGVbJjIEBABJgBrFGLIdDTYREQmFraOwx7zMn7vB2HRgpqpmbnERchuSEcrSABWFQAWFWfIACNiA1WDI8Xp8VAAGAC031gmCowCAA)\r\n\r\nTS 5.5 :\r\n[playground link](https://www.typescriptlang.org/play/?isolatedModules=true&ts=5.5.0-beta#code/FAegVGAEBKCmAOAnWBnWA7ALiymAWskGArgLaQBuAhgDbGED2ikVkKmiAlugOaQDuiKvHiwAJpVr1IDAGa4CRdGQB0kMCGCwAHvCaZcAT1GQAostLiAyh248APABUi2zBjE52XXgD5IAXkgAAwASAG9HAF8ggG5gLQtIADEGBkgw4EhIAA0AyABybXyAGkzIAE08-MN84EjgIKDgAGMGdHZIbQAuMwtrW157FIY-QOGVbJjIEBABJgBrFGLIdDTYREQmFraOwx7zMn7vB2HRgpqpmbnERchuSEcrSABWFQAWFWfIACNiA1WDI8Xp8VAAGAC031gmCowCAA)\r\n\r\n```ts\r\n/** Represents the enum value or a string wrapped value of the enum. */\r\nexport type EnumedString\u003cT extends string> = `${T}`;\r\n\r\nenum Foo {\r\n X = 'x',\r\n Y = 'y'\r\n}\r\n\r\nconst x: EnumedString\u003cFoo> = Foo.X; // works, no error\r\nconst y: EnumedString\u003cFoo> = 'y'; // works in TS 5.4.5 but not TS 5.5.0-beta\r\n```\r\n\r\nThis is not a blocker as we can switch usages of `EnumedString\u003cFoo>` to `${Foo}`\r\n\r\n### IsolatedModules string\r\n\r\nWe noticed more errors like \"FOO has a string type, but must have syntactically\r\nrecognizable string syntax when 'isolatedModules' is enabled.\" for code like\r\nthis:\r\n\r\n```ts\r\nimport {FOO} from './other_module';\r\n\r\nexport enum E = {\r\n FOO,\r\n BAR = 'bar'\r\n};\r\n```\r\n\r\nThese errors seem reasonable and we will `@ts-ignore` to unblock the upgrade.\r\n\r\n### CommonJS module emit bug\r\n\r\nWe are affected by the change in CommonJS module emit bug reported in\r\nhttps://github.com/microsoft/TypeScript/issues/58473. If it's infeasible to fix\r\nby the RC we will add a patch to our internal compiler fork.\r\n","author":{"url":"https://github.com/lauraharker","@type":"Person","name":"lauraharker"},"datePublished":"2024-05-28T22:52:55Z","url":"https://github.com/microsoft/TypeScript/issues/58685"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ee3c964-90cb-c6e8-02de-009eb326ed52 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D644:1E782F:14CBA1F:1B232F8:6B0543B9 |
| html-safe-nonce | 22f6ef69de6fe250f7ee4ddb0a67b2d0868f24e905c929c0471c094e9a4b68ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjQ0OjFFNzgyRjoxNENCQTFGOjFCMjMyRjg6NkIwNTQzQjkiLCJ2aXNpdG9yX2lkIjoiNjg0MzkwNjEzMDI3MjY2NjU1MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6eb8d58c9e34014faf092f30fda71391b802b44e5f8de1011a806eb8a43fd78c |
| hovercard-subject-tag | issue:2322040946 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/58685/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e7ec204aaeadbcc61924b77de74e634440f9927605ca61b33a7b4f166d2f994/microsoft/TypeScript/issues/58685 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e7ec204aaeadbcc61924b77de74e634440f9927605ca61b33a7b4f166d2f994/microsoft/TypeScript/issues/58685 |
| og:image:alt | Acknowledgement I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion. Comment This GitHub issue contains feedback on the TS 5.5-bet... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lauraharker |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width