Skip to content

chore(ts7): adopt the TypeScript 7 native compiler (tsgo)#442

Merged
Aymericr merged 1 commit into
mainfrom
chore/typescript-7-native
Jun 25, 2026
Merged

chore(ts7): adopt the TypeScript 7 native compiler (tsgo)#442
Aymericr merged 1 commit into
mainfrom
chore/typescript-7-native

Conversation

@Aymericr

@Aymericr Aymericr commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adopts the TypeScript 7 native compiler (tsgo, via @typescript/native-preview) for type-checking and local dev watch, while keeping the npm publish path on stable tsc. Also bumps Next 16.2.6 → 16.2.9.

The blocker for TS 7 here was the react-three-fiber + three/webgpu JSX augmentation in viewer: mapping the whole three/webgpu namespace (ThreeToJSXElements<typeof THREE>) made the native checker fail with TS2320 (heritage conflict on PMREMGenerator: core-three's WebGLRenderer arg vs webgpu's abstract Renderer), TS2430, and TS2590 ("union too complex"). tsc 6 tolerated it. This narrows the augmentation to the one webgpu node material used as a JSX tag — <lineBasicNodeMaterial> — following R3F's "extract the classes you need" guidance. Types-only; runtime extend(THREE) is unchanged.

Changes

  • Add @typescript/native-preview (pinned 7.0.0-dev.20260624.1). Coexists with typescript@6, which Next typegen and the IDE plugin still need until the TS 7.1 programmatic API.
  • viewer/index.tsx: narrow the R3F three/webgpu JSX augmentation (see above).
  • check-typestsgo --noEmit (@pascal-app/editor, @repo/ui, editor app, ifc-converter app).
  • Emit packages (core, viewer, mcp, nodes, ifc-converter): devtsgo --build --watch.
  • build / publish unchanged — still tsc --build; prepublishOnly + release.yml untouched. Emitted .d.ts is byte-identical to tsc output.
  • Bump next 16.2.6 → 16.2.9 (apps).

Why publish stays on tsc

tsgo is a nightly preview — we don't ship nightly-emitted artifacts. tsc --build detects tsgo's .tsbuildinfo version mismatch and always rebuilds, and release runs on a clean CI runner, so the publish path is never contaminated by a local tsgo dev build.

Note for consumers

The augmentation narrowing only affects hypothetical external consumers who relied on the old whole-namespace JSX typing to get implicit types for other webgpu node materials (none beyond lineBasicNodeMaterial are used in this repo). Acceptable pre-1.0; the reason is documented in the source comment.

How to test

  1. bun install
  2. bun run check-types → 9/9 green (emit packages build via tsc ^build; editor/ui/apps type-check via tsgo)
  3. bun run check → exit 0 (no new diagnostics from this PR)
  4. bun run build → publish build (tsc) succeeds; dist/*.d.ts unchanged
  5. bun dev → emit packages watch-rebuild via tsgo --build --watch

Checklist

  • Verified locally — check-types 9/9, check exit 0, build 7/7, tsgo --build --watch initial build OK
  • My code follows the existing code style (bun check passes)
  • I've updated relevant documentation (n/a — internal tooling)
  • This PR targets the main branch

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to dev/CI type-check tooling, a targeted R3F type augmentation, and a patch Next bump; production build and publish paths still use tsc.

Overview
Adopts tsgo (@typescript/native-preview) for monorepo type-checking and package dev watch, while publish/CI emit stays on stable tsc --build.

Tooling: Root adds pinned @typescript/native-preview; check-types scripts in the editor/ifc-converter apps and several packages switch from tsc --noEmit to tsgo --noEmit. Emit packages (core, viewer, mcp, nodes, ifc-converter) use tsgo --build --watch for local dev instead of tsc --build --watch.

Types fix for TS 7: In packages/viewer, the R3F three/webgpu JSX module augmentation no longer maps the whole THREE namespace (ThreeToJSXElements<typeof THREE>); it only declares lineBasicNodeMaterial, which unblocks the native checker (TS2320/TS2590). The editor plane-box-select-tool drops a redundant local JSX.IntrinsicElements extension.

Deps: Next is bumped 16.2.6 → 16.2.9 in editor and ifc-converter apps (lockfile updated).

Reviewed by Cursor Bugbot for commit 1b4c656. Bugbot is set up for automated code reviews on this repo. Configure here.

@mintlify

mintlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed Jun 25, 2026, 5:22 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@Aymericr Aymericr force-pushed the chore/typescript-7-native branch from ac23b4a to 647bc79 Compare June 25, 2026 17:27
Make the editor packages compatible with, and benefit from, the native Go
compiler (TypeScript 7 / tsgo) while keeping the npm publish path on stable tsc.

- Add @typescript/native-preview (pinned 7.0.0-dev.20260624.1). tsgo coexists
  with typescript@6, which Next typegen and the IDE plugin still need until the
  TS 7.1 programmatic API ships.
- Fix two react-three-fiber JSX augmentations the native checker rejects but
  tsc tolerated:
  - viewer: map only LineBasicNodeMaterial (the one webgpu node material used as
    a JSX tag) instead of the whole three/webgpu namespace (TS2320/TS2590).
  - plane-box-select-tool: drop the redundant `IntrinsicElements extends
    ThreeElements` block — it duplicated R3F's global augmentation and, by
    referencing @react-three/fiber's ThreeElements directly, hit a bun peer-dep
    variant-directory duplicate under tsgo (TS2320). r3f.d.ts already covers
    those JSX intrinsics. Types-only — no runtime change.
- check-types -> tsgo --noEmit (editor, @repo/ui, editor app, ifc-converter app)
- emit-package dev watch -> tsgo --build --watch
- build/publish stay tsc --build (prepublishOnly + release.yml unchanged;
  emitted .d.ts is byte-identical to tsc output)
- bump next 16.2.6 -> 16.2.9

tsc remains the source of truth and fallback. Published artifacts unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Aymericr Aymericr force-pushed the chore/typescript-7-native branch from 647bc79 to 1b4c656 Compare June 25, 2026 17:47
@Aymericr Aymericr merged commit 460b924 into main Jun 25, 2026
3 of 4 checks passed
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