fix(editor): type optional ancestor traversal for consumers - #814
Open
FenjuFu wants to merge 1 commit into
Open
Conversation
Signed-off-by: FenjuFu <92919259+FenjuFu@users.noreply.github.com>
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #617. A consumer compiling the raw editor TypeScript with
strict: trueandnoUncheckedIndexedAccess: falseinfers the ancestor traversal variable asAnyNode, then rejects the laterundefinedassignment with TS2322. Explicitly typing it asAnyNode | undefinedmakes the traversal compile with either setting. The added import is type-only; runtime behavior is unchanged.How to test
strict: true, andnoUncheckedIndexedAccess: false.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 --checkand 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 checkandbun run testcommands were attempted, but the isolated checkout lacks the workspace-installedbiomeandturboexecutables. Full workspace validation remains for CI/reviewer environment.Screenshots / screen recording
Not applicable: this is a type-only change.
Checklist
bun dev(not run; no runtime change)bun checkneeds workspace dependencies)mainbranch