build: upgrade typescript to v6 and patch tooling symbol-prop bug#20982
Conversation
|
|
This PR is packaged and the instant preview is available (f8076be). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@f8076be
yarn add -D webpack@https://pkg.pr.new/webpack@f8076be
pnpm add -D webpack@https://pkg.pr.new/webpack@f8076be |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20982 +/- ##
==========================================
- Coverage 90.92% 90.91% -0.01%
==========================================
Files 573 573
Lines 58868 58868
Branches 15860 15860
==========================================
- Hits 53525 53522 -3
- Misses 5343 5346 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the TypeScript/tooling stack for TypeScript 6 compatibility and adjusts related type-checking workarounds for schema JSON imports and dynamic AssemblyScript loading.
Changes:
- Upgrades
typescriptto^6.0.3andtoolingtowebpack/tooling#v1.26.2. - Adjusts TypeScript configs for module/hot type checks.
- Adds JSDoc casts around JSON schema
requirecalls and avoids static resolution ofassemblyscript/asc.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
package.json |
Updates TypeScript and tooling dev dependencies. |
yarn.lock |
Locks updated TypeScript and tooling versions. |
tsconfig.module.test.json |
Switches module test resolution to bundler. |
tsconfig.hot.json |
Updates hot type-check target/libs and type package filtering. |
tooling/generate-wasm-code.js |
Uses an indirect dynamic import for AssemblyScript asc. |
lib/webpack.js |
Casts Webpack options schema JSON import. |
lib/index.js |
Casts lazy Webpack options schema JSON import. |
lib/IgnorePlugin.js |
Casts IgnorePlugin schema JSON import. |
lib/cli.js |
Casts CLI schema JSON import. |
lib/asset/AssetModulesPlugin.js |
Casts Webpack schema JSON import before destructuring definitions. |
test/configCases/validate/loader-options/loader.js |
Casts loader option schema JSON import. |
test/configCases/loaders/options/loader-1.js |
Casts loader option schema JSON import. |
test/configCases/loaders/options/loader-2.js |
Casts loader option schema JSON import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "module": "commonjs", | ||
| "lib": ["es5", "dom"], | ||
| "lib": ["es2015", "dom"], | ||
| "types": ["*"], |
There was a problem hiding this comment.
"*" is a documented wildcard for compilerOptions.types in TS 6 — it's handled in getAutomaticTypeDirectiveNames in typescript.js:
function getAutomaticTypeDirectiveNames(options, host) {
if (!usesWildcardTypes(options)) {
return options.types ?? [];
}
// ...wildcard expansion over typeRoots
return deduplicate(flatten(options.types.map((t) => t === "*" ? wildcardMatches : t)), equateValues);
}
function usesWildcardTypes(options) {
return some(options.types, (t) => t === "*");
}When types contains "*", it expands to every package directory under typeRoots (i.e. the pre-TS6 "no types field" default). yarn lint:types-hot passes on the current commit, no TS2688.
Generated by Claude Code
- typescript 5.9.3 -> 6.0.3
- tooling 1.26.1 -> 1.26.2 (includes the upstream fix to generate-types
for the SymbolFlags/TypeFlags category-error that under TS 6 was
silently stripping [Symbol.iterator]() etc. from types.d.ts)
- tooling/generate-wasm-code.js: use an indirect specifier for the
`assemblyscript/asc` dynamic import so TypeScript does not statically
resolve it and pull in its global d.ts which redeclares `require`
- lib/{webpack,index,cli,IgnorePlugin,asset/AssetModulesPlugin}.js and
three test loaders: single EXPECTED_ANY cast around
require("...schema.json") sites that pass the JSON directly to
schema-utils. TS 6 infers JSON imports with `type: string` (widened
from the "object" literal), which no longer satisfies
JSONSchema7TypeName
- tsconfig.hot.json: target ES5 -> ES2015, lib ["es5","dom"] ->
["es2015","dom"] (target ES5 is deprecated in TS 6), and add
"types": ["*"]. TS 6 changed getAutomaticTypeDirectiveNames so that
with `types` unset it returns `[]` instead of auto-discovering every
@types/* package. "*" is the spelling that restores the pre-TS6
implicit behavior
- tsconfig.module.test.json: moduleResolution "node" -> "bundler"
(matches `module: esnext` and avoids the node10 deprecation)
314f1cb to
a382bbb
Compare
Types CoverageCoverage after merging claude/upgrade-typescript-v6-cyziZ into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript 6.0 renumbered TypeFlags.ESSymbol/UniqueESSymbol, exposing a
latent category-error in tooling's generate-types that ANDed prop.flags
(SymbolFlags) against ts.TypeFlags.ESSymbolLike. The check used to keep
Symbol-keyed methods only because SymbolFlags.Method (8192) happened to
overlap with TypeFlags.ESSymbol (8192) in TS 5; under TS 6 the values no
longer overlap so Symbol.iterator etc. were being stripped from the
generated types.d.ts. Patched node_modules/tooling/generate-types via
patch-package to use ts.SymbolFlags.Method, preserving the prior
generated output.
Also adjusts to TS 6 fallout: avoid statically resolving assemblyscript
types in tooling/generate-wasm-code.js (its global d.ts redeclares
require), cast JSON schema requires through Schema, mark
cli.js Schema's CLI extensions optional (they always were in practice),
silence target=ES5 and moduleResolution=node deprecation errors via
ignoreDeprecations, and add types:[node] to tsconfig.hot.json.