Skip to content

fix(editor): type optional ancestor traversal for consumers - #814

Open
FenjuFu wants to merge 1 commit into
pascalorg:mainfrom
FenjuFu:fix/consumer-node-traversal-type
Open

fix(editor): type optional ancestor traversal for consumers#814
FenjuFu wants to merge 1 commit into
pascalorg:mainfrom
FenjuFu:fix/consumer-node-traversal-type

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Sep 10, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #617. A consumer compiling the raw editor TypeScript with strict: true and noUncheckedIndexedAccess: false infers the ancestor traversal variable as AnyNode, then rejects the later undefined assignment with TS2322. Explicitly typing it as AnyNode | undefined makes the traversal compile with either setting. The added import is type-only; runtime behavior is unchanged.

How to test

  1. Compile the affected ancestor traversal with TypeScript 6.0.3, strict: true, and noUncheckedIndexedAccess: false.
  2. Confirm the original source reports TS2322 and this change removes it.
  3. Repeat with noUncheckedIndexedAccess: true; both revisions should compile.

Local focused validation used the actual loop extracted through the TypeScript AST, structural node declarations, and the existing Record<AnyNodeId, AnyNode> scene-map contract. It reproduced the original failure and passed both configurations after the change. This is not a full workspace typecheck. git diff --check and a file-scoped Biome 2.4.16 check also passed. TypeScript 6.0.3 transpilation produced byte-identical JavaScript before and after the type-only change (12,731 bytes).

The required bun run check and bun run test commands were attempted, but the isolated checkout lacks the workspace-installed biome and turbo executables. Full workspace validation remains for CI/reviewer environment.

Screenshots / screen recording

Not applicable: this is a type-only change.

Checklist

  • I've tested this locally with bun dev (not run; no runtime change)
  • My code follows the existing code style (file-scoped pinned Biome passed; full bun check needs workspace dependencies)
  • I've updated relevant documentation (not applicable)
  • This PR targets the main branch

Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
@pascal

pascal Bot commented Sep 10, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 2ca3d529-4606-4906-8727-ef83dfb2a0e9

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.

pointer-support-cap.ts fails type-check unless the consumer enables noUncheckedIndexedAccess

1 participant