Upgrade workspace and fixtures to TypeScript 6#137
Conversation
wyattjoh
left a comment
There was a problem hiding this comment.
Code Review — PR #137
Reviewed with Opus + Codex second-opinion validation.
Blocker
B1. bun run format:check fails on packages/cli-core/src/lib/help.ts:105-115 (codex confirmed)
The terms.map arrow body was converted from an expression to a block but the indent/wrapping parens around helper.formatItem(...) were not re-formatted. CI format:check will reject. Run bun run format and re-push.
Major
M1. Branch is very stale (codex partial)
Merge-base is 85f7cb3b (Nov 2025); main is at 1d746017. ~15 PRs merged since, including changeset enforcement, Homebrew distribution, NonEmptyArray helpers, PKCE rejection sampling, skill infrastructure, and removal of log.ts / runners.ts / installer.ts. Reviewing this PR without rebasing cannot predict post-rebase behavior; the TS 6 sweep will almost certainly conflict with help.ts / spinner.ts / constants.ts. Rebase onto current main, re-run bun run format:check / lint / typecheck / test, then re-open for review.
M2. Next 14 fixture opts out of noUncheckedSideEffectImports rather than fixing the side-effect import (codex confirmed)
test/e2e/fixtures/nextjs-app-router-next14/tsconfig.json:7 sets "noUncheckedSideEffectImports": false. TS 6 has this on by default, and the fixture is meant to represent what downstream users of clerk init would get. Either fix the offending side-effect import in the fixture (preferred; matches user reality), or update the init scaffolder to inject the opt-out into generated Next 14 tsconfigs.
Minor
- m1. Vite-based framework test fixtures (
react.test.ts:19,react-router.test.ts:18,tanstack-start.test.ts:18,vue.test.ts:18) setframework.envFile = ".env", but canonicalFrameworkInfoinlib/framework.ts:45-77declares.env.localfor these frameworks. Tests pass because nothing asserts on this field today. - m2. Root
typecheckscript (package.json:10) covers only@clerk/cli-core;scripts/**/*.tsand e2e fixtures are not validated under TS 6. - m3. No changeset. Touches runtime cli-core files (
auth-server.ts,constants.ts,dotenv.ts,help.ts,spinner.ts,heuristics.ts,transformations.ts,react-router.ts). Post-rebase, theEnforce Changesetworkflow will require one; add a patch-level changeset for@clerk/cli-core. - m4.
ProjectContext.envFile: stringis wider thanFrameworkInfo.envFile: ".env" | ".env.local"(frameworks/types.ts:11). Tightening to the literal union would turn m1 into a compile error.
Nits
FRAMES[0]!fallback inspinner.ts:99is defensive cruft for a non-empty tuple; typingFRAMES as constremoves the need.env-paths{suffix: ""}inconstants.ts:15is behaviorally equivalent to the old{suffix: false}(both falsy); no migration concern, noted for the reviewer's benefit.
Positives
Switching from expect(arr[0].foo).toBe(...) to destructure + toBeDefined() + optional chaining is the right pattern for noUncheckedIndexedAccess. FrameworkTemplateName = Exclude<TemplateName, "generic"> is a correct fix: the prior Exclude<TemplateName, "generic" | "generic-fallback"> was wrong because "generic-fallback" is actually referenced as a framework template in FRAMEWORK_PROMPTS.vite.template. TS 6 forced the discovery of a latent type bug. plapi.test.ts was rewritten to use getPlapiBaseUrl() rather than hardcoding api.clerk.com, making the suite portable across environments. heuristics.ts added an explicit "Invalid package manager install command" guard rather than silently propagating undefined.
Summary
typescript@6.0.2typecheckentrypoints for TS6cli-coreTS6 diagnostics and align tests and fixtures with the new compiler behaviorCommits
build: upgrade workspace to TypeScript 6.0.2fix: resolve TypeScript 6 diagnostics in cli-coretest: align cli-core tests with TypeScript 6chore: upgrade e2e fixtures to TypeScript 6Verification
bun installbun run typecheckbun run buildbun run testcd packages/cli-core/mocks && bun install && bunx tsc --noEmitnextjs-app-routernextjs-pages-routernextjs-app-router-next14react-routerreactvuetanstack-startNotes
bun run test:e2ewas not run because this environment does not have the required Clerk e2e secrets (CLERK_PLATFORM_API_KEY,CLERK_CLI_TEST_APP_ID, etc.)