Skip to content

build: run typechecks with native TypeScript 7 - #59

Open
amondnet wants to merge 1 commit into
mainfrom
feat/ts7-native-side-by-side
Open

build: run typechecks with native TypeScript 7#59
amondnet wants to merge 1 commit into
mainfrom
feat/ts7-native-side-by-side

Conversation

@amondnet

@amondnet amondnet commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • install native TypeScript 7 under the @typescript/native alias so Bun links direct tsc invocations to the faster native compiler
  • retain TypeScript 6 as the typescript package for API consumers such as typescript-eslint
  • verify in CI that the selected tsc binary remains TypeScript 7

Motivation

TypeScript 7 provides substantially faster native compilation, but it does not expose the JavaScript compiler API required by typescript-eslint. The TypeScript team recommends running TypeScript 6 and 7 side-by-side during this transition:

The documented @typescript/typescript6 alias layout currently resolves circularly under Bun 1.3.14. This PR uses the Bun-compatible equivalent: normal typescript@^6.0 for imports and @typescript/native as an alias to typescript@^7.0.2 for the tsc binary.

Verification

  • bun install --frozen-lockfile
  • bun run lint
  • bun run check:typescript-versionVersion 7.0.2
  • bun run typecheck --force → 9 successful tasks, 0 cached
  • direct tsc workspaces (worker, core, CLI, and create-statusbeam) each resolve Version 7.0.2
  • the CI guard predicate rejects Version 6.0.3 with a non-zero exit code

Caveats

  • Editor language services continue to use TypeScript 6 because TypeScript 7 does not provide the legacy tsserver API.
  • Astro checks are not accelerated: the docs workspace retains TypeScript 5.9, and Astro's checker currently supports TypeScript 5/6.
  • Dependabot may not automatically update the aliased @typescript/native dependency.
  • Remove the alias and compatibility guard once typescript-eslint supports the TypeScript 7.1 API.
  • If the dependency lockfile changes before merge, this branch may need a trivial bun.lock rebase.

Summary by cubic

Run typechecks with the native TypeScript 7 compiler for faster tsc, while keeping typescript@^6 for tools that use the JS API like typescript-eslint. Adds the @typescript/native alias to typescript@^7.0.2 and a CI check (bun run check:typescript-version) to ensure tsc stays on 7.x.

Written for commit 0119243. Summary will update on new commits.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds the @typescript/native dependency and introduces a check:typescript-version script to package.json. The reviewer feedback correctly identifies a portability issue with using grep on Windows environments and suggests a cross-platform Bun one-liner to verify the TypeScript version instead.

Comment thread package.json
"setup": "bash scripts/setup.sh",
"deploy": "bun run --filter '@statusbeam/worker' deploy && bun run --filter '@statusbeam/web' deploy"
"deploy": "bun run --filter '@statusbeam/worker' deploy && bun run --filter '@statusbeam/web' deploy",
"check:typescript-version": "tsc --version | grep -E '^Version 7\\.'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

[MEDIUM] Non-portable grep command in package.json script

Problem: The check:typescript-version script uses grep, which is not natively available on Windows environments, leading to potential failures for Windows contributors.
Rationale: To ensure cross-platform compatibility and a consistent developer experience, scripts in package.json should avoid platform-specific shell utilities like grep.
Suggestion: Use a cross-platform Bun/Node.js one-liner to verify the TypeScript version.

Suggested change
"check:typescript-version": "tsc --version | grep -E '^Version 7\\.'"
"check:typescript-version": "bun -e \"if (!require('child_process').execSync('tsc --version').toString().startsWith('Version 7.')) process.exit(1)\""

@sonarqubecloud

Copy link
Copy Markdown

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtypescript@​7.0.29910089100100

View full report

@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a side-by-side TypeScript toolchain that preserves TypeScript 6 for JavaScript API consumers while selecting the native TypeScript 7 compiler for direct tsc invocations.

  • Adds the aliased @typescript/native dependency and locks its platform-specific binaries.
  • Adds a script that verifies the selected compiler reports TypeScript 7.
  • Runs the compiler-version guard in CI before workspace typechecking.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable issues identified.

The dependency layout preserves TypeScript 6 under its normal package name, exposes TypeScript 7 through the alias for direct compiler invocations, and adds a CI guard to detect incorrect binary selection.

Important Files Changed

Filename Overview
package.json Adds the native TypeScript 7 alias and a compiler-version guard while retaining TypeScript 6 for API consumers.
.github/workflows/ci.yml Runs the new TypeScript version guard before the existing typecheck job.
bun.lock Locks TypeScript 7.0.2 and its optional platform-specific native compiler packages.

Reviews (1): Last reviewed commit: "build: run typechecks with native TypeSc..." | Re-trigger Greptile

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