Skip to content

Upgrade workspace and fixtures to TypeScript 6#137

Draft
rafa-thayto wants to merge 4 commits intomainfrom
codex/typescript-6-upgrade
Draft

Upgrade workspace and fixtures to TypeScript 6#137
rafa-thayto wants to merge 4 commits intomainfrom
codex/typescript-6-upgrade

Conversation

@rafa-thayto
Copy link
Copy Markdown
Contributor

Summary

  • upgrade the workspace and checked-in fixtures to [email protected]
  • add explicit Bun ambient types and root/cli-core typecheck entrypoints for TS6
  • fix cli-core TS6 diagnostics and align tests and fixtures with the new compiler behavior

Commits

  • build: upgrade workspace to TypeScript 6.0.2
  • fix: resolve TypeScript 6 diagnostics in cli-core
  • test: align cli-core tests with TypeScript 6
  • chore: upgrade e2e fixtures to TypeScript 6

Verification

  • bun install
  • bun run typecheck
  • bun run build
  • bun run test
  • cd packages/cli-core/mocks && bun install && bunx tsc --noEmit
  • Bun-based smoke validation for touched fixtures:
    • nextjs-app-router
    • nextjs-pages-router
    • nextjs-app-router-next14
    • react-router
    • react
    • vue
    • tanstack-start

Notes

  • bun run test:e2e was not run because this environment does not have the required Clerk e2e secrets (CLERK_PLATFORM_API_KEY, CLERK_CLI_TEST_APP_ID, etc.)

Copy link
Copy Markdown
Contributor

@wyattjoh wyattjoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) set framework.envFile = ".env", but canonical FrameworkInfo in lib/framework.ts:45-77 declares .env.local for these frameworks. Tests pass because nothing asserts on this field today.
  • m2. Root typecheck script (package.json:10) covers only @clerk/cli-core; scripts/**/*.ts and 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, the Enforce Changeset workflow will require one; add a patch-level changeset for @clerk/cli-core.
  • m4. ProjectContext.envFile: string is wider than FrameworkInfo.envFile: ".env" | ".env.local" (frameworks/types.ts:11). Tightening to the literal union would turn m1 into a compile error.

Nits

  • FRAMES[0]! fallback in spinner.ts:99 is defensive cruft for a non-empty tuple; typing FRAMES as const removes the need.
  • env-paths {suffix: ""} in constants.ts:15 is 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.

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.

2 participants