You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
createRegistry's seek() has two non-null assertions that are unnecessary and can be deleted with no behavior change:
// packages/0/src/composables/createRegistry/index.ts (in seek())constticket=tickets[i]!// x2 — in the 'last' and 'first' loops
Why they're spurious
tickets is the result of values(), typed readonly E[].
packages/0 extends @vue/tsconfig/tsconfig.dom.json → base tsconfig.json, neither of which enables noUncheckedIndexedAccess (only tsconfig.lib.json does, and dom doesn't extend it). So tickets[i] is already typed E, not E | undefined.
The loops are also bounded (i >= 0 and i < tickets.length), so the index is always in range regardless.
Fix
Drop the ! on both tickets[i]! occurrences in seek(). Pure type-level cleanup — tickets[i] already has type E.
These are the last spurious ! in createRegistry/index.ts. The remaining assertions elsewhere in the file (listeners.get(event)!, get(id)! in the duplicate-register branch) are genuine Map.get bangs that document an invariant the type system can't see — leave those.
createRegistry'sseek()has two non-null assertions that are unnecessary and can be deleted with no behavior change:Why they're spurious
ticketsis the result ofvalues(), typedreadonly E[].packages/0extends@vue/tsconfig/tsconfig.dom.json→ basetsconfig.json, neither of which enablesnoUncheckedIndexedAccess(onlytsconfig.lib.jsondoes, and dom doesn't extend it). Sotickets[i]is already typedE, notE | undefined.i >= 0andi < tickets.length), so the index is always in range regardless.Fix
Drop the
!on bothtickets[i]!occurrences inseek(). Pure type-level cleanup —tickets[i]already has typeE.Notes
!from this file by storing ticket refs in theorderarray); these two live inseek()and were left out of scope there.!increateRegistry/index.ts. The remaining assertions elsewhere in the file (listeners.get(event)!,get(id)!in the duplicate-register branch) are genuineMap.getbangs that document an invariant the type system can't see — leave those.