Skip to content

chore(deps): upgrade TypeScript to 6#376

Merged
RaananW merged 3 commits into
masterfrom
raananw-deps-typescript-6-vite-8
Jul 9, 2026
Merged

chore(deps): upgrade TypeScript to 6#376
RaananW merged 3 commits into
masterfrom
raananw-deps-typescript-6-vite-8

Conversation

@RaananW

@RaananW RaananW commented Jul 7, 2026

Copy link
Copy Markdown
Member

Scope

Bumps TypeScript ^5.7.0^6.0.3 across the workspace only. Vite is unchanged (stays at its existing ^6.x pins).

This PR was originally TS6 + Vite 8 together, but a split diagnostic showed the two majors carry independent risk, so the Vite 8 (rolldown-vite) work has been moved to its own separate draft PR (#377, parked as exploration). This PR is now a clean, zero-ceiling/zero-golden TypeScript-6-only change and is the deliverable.

Version bumps

typescript ^5.7.0 → ^6.0.3 in: root, packages/babylon-lite, packages/babylon-lite-gl, packages/babylon-lite-compat, lab, playground. pnpm-lock.yaml regenerated (TS-only delta; resolves TS 5.9.3 → 6.0.3).

Code changes required by TS 6

  • packages/babylon-lite/src/material/node/node-geometry-renderable.ts — copy the readonly _vertexBuffers array (buffers: [...a._vertexBuffers]) when passing it as GPUVertexState.buffers. TS6 tightened the WebGPU typings so a readonly array is no longer assignable to the mutable buffers field. Semantics-preserving (shallow copy only; no runtime/render change).
  • tests/lite/build/public-api-types.test.ts, tests/gl/build/public-api.test.ts — add --ignoreConfig to the standalone tsc invocations. TS6 now errors (TS5112) when a file is passed on the command line while a tsconfig.json exists in cwd; --ignoreConfig is the flag the error itself recommends.
  • tests/lite/build/public-api-types.test.ts — drop --types @webgpu/types. TS6's built-in dom lib now bundles the WebGPU declarations, so also loading the @webgpu/types package duplicates them and (without skipLibCheck, which this test deliberately omits to catch leaking internal types) trips TS6200/TS2717 conflicts. The native lib fully covers every GPU* type the public build/index.d.ts references — verified type-checks clean.

No tsconfig strictness was loosened; no blanket any / @ts-ignore was added.

Bundle manifests

All per-scene bundle manifests were regenerated under TS6. Codegen is byte-identical to the TS5/Rollup baseline for every scene except twoscene104.json and scene149.json — which shift by a fraction of a KB (gzip rounding, e.g. 44.5 → 44.6 KB). Those two are therefore the only manifest files this PR changes vs master, and both remain within existing size ceilings (0 overages). (An earlier revision of this description said "46 manifests"; that reflected a mid-work snapshot before the TS6-only split — the accurate figure vs master is 2.)

Test / build results (TS6 + Vite 6)

  • pnpm run lint (eslint + tsc --noEmit across all tsconfigs): ✅ green
  • pnpm test:unit ✅ · pnpm test:build ✅ · pnpm test:unit:gl ✅ · pnpm test:build:gl
  • pnpm build:lib, pnpm build, pnpm build:gl, pnpm build:playground: ✅ exit 0
  • Locked parity + bundle-size on LAB_TEST_PORT=5279: 0 bundle-size overages ✅. Only scene116 parity fails (see below); scene144 now passes after merging master's widened 0.072 ceiling (docs(parity): scene144 bloom parity ceiling investigation (ON HOLD) #380).

scene116 is pre-existing local-GPU noise — NOT introduced here

scene116 fails byte-identically on unmodified master (TS 5.9.3 + Vite 6, this branch's changes reverted): MAD 0.2883984375… vs threshold 0.01. It is machine/GPU-specific strict-threshold noise that is green on CI, and fails with and without this PR's changes, so it is not a regression from the TS6 upgrade — a reviewer should not be alarmed. scene144 (0.07000434…) previously sat a hair over the old 0.07 threshold but now passes under master's widened 0.072 ceiling (#380). No golden references or thresholds were touched.

Notes

Bump typescript ^5.7.0 -> ^6.0.3 across the workspace (root, babylon-lite,
babylon-lite-gl, babylon-lite-compat, lab, playground). Vite is left at its
existing ^6.x pins; the Vite 8 (rolldown-vite) upgrade is handled in a
separate PR so the bundler switch can be evaluated on its own merits.

Code changes required by TS6:

- node-geometry-renderable.ts: copy the readonly `_vertexBuffers` array
  (`[...a._vertexBuffers]`) when passing it as `GPUVertexState.buffers`.
  TS6 tightened the WebGPU typings so a readonly array is no longer assignable
  to the mutable `buffers` field. Semantics-preserving (shallow copy only).

- tests/lite/build/public-api-types.test.ts and tests/gl/build/public-api.test.ts:
  add `--ignoreConfig` to the standalone `tsc` invocations. TS6 now errors
  (TS5112) when a file is passed on the command line while a tsconfig.json
  exists in cwd; `--ignoreConfig` is the recommended flag.

- tests/lite/build/public-api-types.test.ts: drop `--types @webgpu/types`.
  TS6's built-in `dom` lib now bundles the WebGPU declarations, so also
  loading the `@webgpu/types` package duplicates them and, without
  skipLibCheck (deliberately omitted by this test), trips TS6200/TS2717
  conflicts. The native lib fully covers the GPU* types the public d.ts uses.

Regenerated 46 per-scene bundle manifests reflecting TS6 codegen byte
differences (all within existing size ceilings). No tsconfig strictness was
loosened and no `any`/`@ts-ignore` was added.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@RaananW RaananW force-pushed the raananw-deps-typescript-6-vite-8 branch from ad18753 to 8527a42 Compare July 7, 2026 16:02
@RaananW RaananW changed the title chore(deps): TypeScript 6 + Vite 8 chore(deps): upgrade TypeScript to 6 Jul 7, 2026
ryantrem pushed a commit that referenced this pull request Jul 7, 2026
## ⚠️ PENDING USER APPROVAL — ceiling change, do NOT merge without
sign-off

This proposes raising **scene144** (bloom post-process) `maxMad` from
**0.07 → 0.072** in `scene-config.json`. Per GUIDANCE, a scene MAD
ceiling may not be raised without explicit user approval — this draft is
a **proposal + justification only**.

## Root cause

scene144's parity gate has **no committed golden**
(`reference/**/babylon-ref-*.png` is gitignored), so every run captures
a **live Babylon.js reference** and compares it against the **live
Babylon Lite** render on the same renderer — a genuine two-engine
comparison.

The two independent WebGPU float pipelines computing a full-screen,
**multi-pass Gaussian bloom** differ only at the **8-bit quantization
floor**:

| Metric | Value |
|---|---|
| Pixels exact match | **92.1%** |
| Within 1 LSB | 97.2% |
| Within 2 LSB | 99.6% |
| Share of MAD from ≤2-LSB gradient rounding | **71%** |

MAD here is measured in 0–255 space, so 0.07 means an average
per-channel difference of **0.07/255 ≈ 0.03%** — essentially
pixel-perfect. The residual is dominated by unavoidable ±1–2 LSB
rounding across the smooth bloom gradient, which quantizes differently
between renderers.

## Why it's an inherent floor, not a closable bug

- Bloom params (**threshold 0.1, weight 2, kernel 64, scale 0.5**) and
the extract/blur/merge math already match the BJS reference
(`bjs/scene144.ts`) exactly.
- The BJS engine uses `antialias: true`. I tried mirroring that by
rendering the Lite source into a 4× MSAA target and resolving before
bloom — parity got **4× worse (MAD 0.309)**, proving BJS's bloom input
is effectively single-sample and the current single-sample Lite config
is already the closest match. There is **no closable algorithmic
drift**.

## Measurements (deterministic, zero run-to-run variance)

The scene is fully deterministic (frozen animation frame 180, fixed
camera). The only variable is the renderer's float rounding:

| Environment | MAD | vs ceiling 0.07 |
|---|---|---|
| Hardware GPU (local, ×3 fresh-golden runs) | **0.0700043** | +4.3e-6 |
| CI SwiftShader (cloud) | **0.0700051** | +5.1e-6 |

The old 0.07 ceiling was calibrated right at this floor, so
deterministic cross-renderer rounding on a handful of pixels tips it
over. CI's SwiftShader is deterministic, hence the identical failure
across independent cloud runs.

## Proposed fix

Widen `maxMad` to **0.072** (with an inline `note` capturing this
justification). That clears the observed floor by ~2.8% while staying
**orders of magnitude below any genuine bloom regression** (a wrong
weight/threshold/kernel moves MAD by ≥ 0.1, not millionths).

## Scope

Standalone, **pre-existing** issue on master — independent of the
dependency PRs (#374 / #376). Config-only change; no engine code
(`packages/babylon-lite/src/**`) touched. `pnpm run lint` passes.

---
**Recommendation: approve the 0.072 widen.** Alternative if a ceiling
bump is undesirable: commit a golden PNG for scene144 (like other
scenes) so the gate becomes Lite-vs-fixed-golden instead of
live-two-engine — but that trades one calibration problem for another
and still carries cross-renderer quantization. The ceiling widen is the
cleaner, honest fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ript-6-vite-8

# Conflicts:
#	lab/public/bundle/manifest/scene113.json
#	lab/public/bundle/manifest/scene114.json
#	lab/public/bundle/manifest/scene146.json
#	lab/public/bundle/manifest/scene179.json
@bjsplat

bjsplat commented Jul 8, 2026

Copy link
Copy Markdown

Lab - Static Site

Open deployed site

Build 20260708.11 - merge @ 0f80a5b

…ript-6-vite-8

# Conflicts:
#	lab/public/bundle/manifest/scene129.json
#	package.json
#	pnpm-lock.yaml
@bjsplat

bjsplat commented Jul 8, 2026

Copy link
Copy Markdown

Lab - Static Site

Open deployed site

Build 20260708.21 - merge @ f45211f

@RaananW RaananW marked this pull request as ready for review July 9, 2026 11:49
Copilot AI review requested due to automatic review settings July 9, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the workspace TypeScript toolchain to TypeScript 6.0.3 and applies the minimal code/test-harness adjustments needed to keep the build and public-API type validation working under TS6, while keeping Vite unchanged.

Changes:

  • Bump typescript from ^5.7.0 to ^6.0.3 across the workspace (plus lockfile refresh).
  • Update isolated .d.ts typecheck tests to pass --ignoreConfig, and stop explicitly loading @webgpu/types in the Lite public API typecheck to avoid TS6 WebGPU lib duplication.
  • Adjust a WebGPU pipeline descriptor to satisfy TS6’s stricter WebGPU typings by copying a readonly vertex buffer layout array.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Bumps root TypeScript devDependency to ^6.0.3.
pnpm-lock.yaml Lockfile refresh reflecting TypeScript 6 resolution and updated peer snapshots.
packages/babylon-lite/package.json Bumps package TypeScript devDependency to ^6.0.3.
packages/babylon-lite-gl/package.json Bumps package TypeScript devDependency to ^6.0.3.
packages/babylon-lite-compat/package.json Bumps package TypeScript devDependency to ^6.0.3.
lab/package.json Bumps lab TypeScript dependency to ^6.0.3.
playground/package.json Bumps playground TypeScript dependency to ^6.0.3.
packages/babylon-lite/src/material/node/node-geometry-renderable.ts Copies _vertexBuffers when used in GPUVertexState.buffers to satisfy TS6 WebGPU typing.
tests/lite/build/public-api-types.test.ts Adds --ignoreConfig to TS6 CLI invocation; removes --types @webgpu/types to avoid TS6 lib conflicts.
tests/gl/build/public-api.test.ts Adds --ignoreConfig to TS6 CLI invocation for .d.ts typechecking.
lab/public/bundle/manifest/scene104.json Updates committed per-scene bundle manifest after toolchain/codegen change.
lab/public/bundle/manifest/scene149.json Updates committed per-scene bundle manifest after toolchain/codegen change.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lab/public/bundle/manifest/scene149.json
@RaananW RaananW enabled auto-merge (squash) July 9, 2026 12:14
@bjsplat

bjsplat commented Jul 9, 2026

Copy link
Copy Markdown

Lab - Static Site

Open deployed site

Build 20260709.7 - merge @ 7f64fe4

@RaananW RaananW merged commit da4d411 into master Jul 9, 2026
12 checks passed
@RaananW RaananW deleted the raananw-deps-typescript-6-vite-8 branch July 9, 2026 13:08
RaananW added a commit that referenced this pull request Jul 9, 2026
Resolve lab/package.json: keep our @BabylonJS 9.16.0 / manifold-3d 3.5.1 /
gltf2interface 9.16.0 bumps; take master's typescript ^6.0.3 (sibling TS6 PR #376).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

4 participants