What
A sweep of the corpus's 97 as unknown as sites found several documented-legitimate casts
(real @types/three gaps: PassNode.options — B11, BloomNode.highPassFn — B24,
Points.count — B34) that typecheck fine with the unknown intermediate hop dropped — a
plain as { options: … } / as ReturnType<typeof …> compiles clean, because the target
type still overlaps the source closely enough for TS's single-step assertion rule.
The double-hop form isn't wrong (it's the maximally-permissive form and never fails), but
it's stronger than the gap requires and reads as "TS is fighting me here" when a lighter
cast would do. One family (the backgroundNode/fogNode/environmentNode sites) was
already fully removed in an earlier sweep because @types/three closed that gap entirely.
This issue is about the remaining ~10 files' worth of double-hop casts that are still
necessary but could be single-hop.
Why it matters
Corpus-wide in reach but cosmetic — no correctness or behavior change, purely how tightly
each cast is scoped. Worth doing as a deliberate, verifiable pass (test each site with
as X, keep as unknown as X only where the compiler still demands it) rather than
mixed into an unrelated task, since verifying ~10 sites individually against tsc is
exactly mechanical-but-not-zero-risk enough to want its own PR and diff.
Recommendation already on file
docs/REVIEW-QUEUE.md #16: worth doing in the same pass as whatever normalizes the B11
comment wording, not as a rushed follow-up to a task whose ask was "remove the unnecessary
ones" rather than "minimize the necessary ones."
Pointer
docs/REVIEW-QUEUE.md §16 ("as unknown as X vs plain as X — should the corpus prefer
the minimal cast?").
What
A sweep of the corpus's 97
as unknown assites found several documented-legitimate casts(real
@types/threegaps:PassNode.options— B11,BloomNode.highPassFn— B24,Points.count— B34) that typecheck fine with theunknownintermediate hop dropped — aplain
as { options: … }/as ReturnType<typeof …>compiles clean, because the targettype still overlaps the source closely enough for TS's single-step assertion rule.
The double-hop form isn't wrong (it's the maximally-permissive form and never fails), but
it's stronger than the gap requires and reads as "TS is fighting me here" when a lighter
cast would do. One family (the
backgroundNode/fogNode/environmentNodesites) wasalready fully removed in an earlier sweep because
@types/threeclosed that gap entirely.This issue is about the remaining ~10 files' worth of double-hop casts that are still
necessary but could be single-hop.
Why it matters
Corpus-wide in reach but cosmetic — no correctness or behavior change, purely how tightly
each cast is scoped. Worth doing as a deliberate, verifiable pass (test each site with
as X, keepas unknown as Xonly where the compiler still demands it) rather thanmixed into an unrelated task, since verifying ~10 sites individually against
tscisexactly mechanical-but-not-zero-risk enough to want its own PR and diff.
Recommendation already on file
docs/REVIEW-QUEUE.md#16: worth doing in the same pass as whatever normalizes the B11comment wording, not as a rushed follow-up to a task whose ask was "remove the unnecessary
ones" rather than "minimize the necessary ones."
Pointer
docs/REVIEW-QUEUE.md§16 ("as unknown as Xvs plainas X— should the corpus preferthe minimal cast?").