Repository navigation
build: update to TypeScript 6 - #11588
Draft
edusperoni wants to merge 4 commits into
Draft
edusperoni wants to merge 4 commits into
edusperoni wants to merge 4 commits into
Conversation
- typescript 6.0.3 across the workspace and test apps - Nx 22.5.4 -> 22.7.12 (22.5 pins @phenomnomnominal/tsquery 6.1, which rejects TS 6) - Angular dev tooling 21 -> 22, @analogjs/vite-plugin-angular 2.9.2 (first lines that accept TS 6) - typescript-eslint 8.72, ts-jest 29.4.15, typedoc 0.28.20, ts-patch 4 - apply the @nx/vitest 22.6 reportsDirectory migration - vite: resolve own hmr client files relatively (stricter enforce-module-boundaries in Nx 22.7) - drop stale extraneous entries from package-lock.json
- remove baseUrl; paths entries are now relative to the declaring tsconfig - replace target es5 (tools) with the workspace ES2020 target - drop the ignoreDeprecations "5.0" escape hatch - set strict: false explicitly (TS 6 defaults it to true) - list types explicitly where configs relied on implicit @types inclusion (TS 6 defaults types to []) - typedoc config: inherit module/lib from the base config so core type-checks under it - apps/ui: drop the unused tns-core-modules/* path mapping
- use the namespace keyword instead of module for namespace declarations (an error in TS 6) - add webinspector-network.d.ts so the side-effect import in inspector_modules resolves (noUncheckedSideEffectImports is on by default in TS 6) - global-types.d.ts: import data/observable relatively instead of through baseUrl
…S5 snippets TypeScript 6 always emits "use strict" for transpiled snippets that have no imports/exports. The NativeClass downlevel splices that output into the host module, so the prologue would land mid-file (or become the file prologue).
|
View your CI Pipeline Execution ↗ for commit 17063bd
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
The workspace builds with TypeScript 5.9. Under TypeScript 6 the tsconfigs fail on deprecated options (
baseUrl,target: es5), several configs lose their implicit@types, and core fails to build because of a side-effect import that can't be resolved.What is the new behavior?
Everything builds with TypeScript 6.0.3. Deprecations are fixed rather than silenced: there is no
ignoreDeprecationsanywhere, and the old"5.0"escape hatch is removed too.strictstays off (set explicitly, since TS 6 turns it on by default).Dependencies (
build: update to TypeScript 6.0)typescript6.0.3 at the root, inpackages/webpack5, and in the test apps.@phenomnomnominal/tsquery6.1, which rejects TS 6. 22.7 stays on major 22, so@nativescript/nx@22still fits.@analogjs/vite-plugin-angular2.1.3 → 2.9.2.@angular/build@21caps TS below 6.0.@nativescript/vitealready lists^22as a peer.typescript-eslint8.72,ts-jest29.4.15,typedoc0.28.20,ts-patch4 (the first versions that accept TS 6).@nx/vitest22.6reportsDirectorymigration.require.resolveof its own HMR client files now uses relative paths. This fixes the stricter@nx/enforce-module-boundariescheck in Nx 22.7. Theexportsmap is identity, and I checked that both forms resolve to the same file indist.extraneousentries frompackage-lock.json(apps/*,dist/*,packages/*). They pinned Angular 21 and blocked resolution.tsconfigs (
build: migrate tsconfigs off options deprecated in TypeScript 6)baseUrlremoved everywhere.pathsentries are now./-relative to the tsconfig that declares them.target: es5in the tools configs is replaced by the workspace ES2020 target.strict: falseis set explicitly, andtypesis listed explicitly where configs relied on implicit@types(webpack5 jest/node, devtools node).module/libfrom the base config. On 5.9 it stopped at a config error (TS5095);typedoc --emit nonenow reports 0 errors.Declarations (
fix(core): declarations compatible with TypeScript 6)module Foo {}→namespace Foo {}in hand-written declarations (global-types.d.ts,interop.d.ts,org.nativescript.widgets.d.ts,android-declarations.d.ts). TS 6 makes this an error. In.d.tsfiles it only shows up withskipLibCheck: false, so consumers who check lib files would hit it.debugger/webinspector-network.d.ts. The module only has.ios/.androidfiles, soimport './debugger/webinspector-network'failed under TS 6's defaultnoUncheckedSideEffectImports.global-types.d.tsusedimport('data/observable'), which only resolved throughbaseUrl. It is now relative.NativeClass (
fix(webpack,vite): strip the "use strict" prologue…)"use strict"when transpiling a snippet that has no imports or exports. The NativeClass ES5 downlevel splices that output into the host module. All five transpile sites now strip the prologue. Output is otherwise byte-identical to 5.9. (moduleDetection: forcewas rejected because it appendsexport {}, which is invalid where the webpack transformer splices into blocks.)Verification
nx run-many -t build -p core,webpack5,vite: passes. The core dist still has__extendsNativeClass output and no stray"use strict".tsc --noEmitacross all 17 tsconfigs: same as the TS 5.9 baseline onmainor better. The remaining errors exist onmaintoo (spec configs, apps without installed deps).mainexactly: the webpack5 snapshots hard-code/Users/nstudio/...paths, and vite'stypescript-optional.specpasses when run alone.main(the same 3 pre-existing vite errors).Known follow-ups (not in this PR)
androidx-*.d.tsandandroid-platform-*.d.tsintypes-android/types-minimalstill usemodule org { … }, about 85k occurrences. This is the same TS 6 error, visible to consumers withskipLibCheck: false. It needs a mechanical conversion, ideally fixed in the typings generator, as a separate change.transpileModulewithtarget: ES5. TS 6 still supports this (it raises a deprecation diagnostic that these call sites don't report). TS 7 removes ES5 output, so that downlevel will need another approach before 7.@nx/eslint22.x and thenativescriptCLI ship their own nested TypeScript (5.9 / 5.7). That copy doesn't affect builds here.