Skip to content

Upgrade TypeScript to 7 (build failing — needs review) - #569

Draft
woksin wants to merge 2 commits into
mainfrom
chore/typescript-7
Draft

Upgrade TypeScript to 7 (build failing — needs review)#569
woksin wants to merge 2 commits into
mainfrom
chore/typescript-7

Conversation

@woksin

@woksin woksin commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Upgrades the Samples repo to TypeScript 7.0.2 (the native compiler, current latest on npm), a drop-in for tsc/tsserver.

The TypeScript compiler/typecheck passes cleanly on both sample workspaces. However, the full yarn build (Vite) currently fails because a framework dependency (@cratis/arc.vite) uses the classic TypeScript programmatic API, which TS7's native package no longer exposes from its main entry. This is a dependency/tooling incompatibility, not a Samples code issue — see Blocker below.

Packages changed (old → new)

Package Field Old New
root package.json devDependencies.typescript 6.0.3 7.0.2

typescript is declared only in the root workspace. @types/*, @typescript-eslint/*, typescript-eslint, and rollup-plugin-typescript2 were intentionally left untouched.

Package manager

Yarn 4.5.3 (yarn workspaces, nodeLinker: node-modules). yarn install completes successfully. Note: yarn.lock is gitignored in this repo, so no lockfile appears in the diff.

Required accommodations for TS7 under Yarn

Two changes were needed for TS7 to install and typecheck — both are direct consequences of TS7's native packaging, not code changes:

  1. Yarn builtin compat/typescript patch bypass — Yarn 4 unconditionally rewrites the typescript dependency through its builtin compat/typescript patch, which edits lib/_tsc.js / lib/tsserver.js / lib/typescript.js. The TS7 native package ships only lib/tsc.js + bin/tsc, so the patch fails with ENOENT. Added a tiny local Yarn plugin (.yarn/plugins/plugin-disable-typescript-compat.cjs, registered in .yarnrc.yml) that runs after the compat plugin and unwraps the builtin patch back to the plain npm descriptor.
  2. baseUrl removal migration — TS7 removed the baseUrl compiler option (TS5102) and requires paths values to be relative (TS5090). Migrated tsconfig.json, Library/Lending/.frontend/tsconfig.json, and Library/Members/.frontend/tsconfig.json accordingly (removed baseUrl, prefixed paths values with ../).

Verification

  • typescript resolves to 7.0.2 (native); node_modules/.bin/tsc --versionVersion 7.0.2.
  • tsc -b .frontend/tsconfig.json (full --force rebuild): PASS, zero errors, on both Library/Lending and Library/Members.
  • yarn build (Vite): FAILS — see Blocker.

Blocker (needs review)

yarn build fails during Vite's transform step inside @cratis/arc.vite's EmitMetadataPlugin:

TypeError: Cannot read properties of undefined (reading 'fileExists')
    at parseTsConfig (@cratis/arc.vite/dist/esm/EmitMetadataPlugin.js)

Root cause: TS7's native typescript package exports only { version, versionMajorMinor } from its main entry — the classic programmatic API (ts.sys, ts.findConfigFile, ts.parseJsonConfigFileContent, …) moved to typescript/unstable/*. EmitMetadataPlugin does import ts from 'typescript' and calls ts.sys.fileExists, so ts.sys is undefined under TS7. This requires a TS7-native-compatible release of @cratis/arc.vite (and likely other TS-API consumers such as vite-tsconfig-paths and @typescript-eslint); it cannot be fixed within the Samples repo. The TypeScript bump and typecheck are otherwise green.

Workflow changes

None. grep of .github/workflows/ found no explicit typescript version pins or tsc install steps, so no workflow files were modified.

🤖 Generated with Claude Code

Update Samples to TypeScript 7 (the native compiler) for improved
build/typecheck performance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@woksin
woksin marked this pull request as draft July 10, 2026 09:24
@woksin

woksin commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Draft: blocked only by @cratis/arc.vite's EmitMetadataPlugin (uses the TS programmatic API removed in TS 7) failing vite build. TS 7 port up in Cratis/Arc#2340; once published and the dependency is bumped here, this unblocks. Typecheck already passes on TS 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant