Skip to content

fix(createRegistry): remove spurious non-null assertions in seek()#282

Open
sridhar-3009 wants to merge 1 commit into
vuetifyjs:masterfrom
sridhar-3009:fix/remove-non-null-assertions-createRegistry-seek-281
Open

fix(createRegistry): remove spurious non-null assertions in seek()#282
sridhar-3009 wants to merge 1 commit into
vuetifyjs:masterfrom
sridhar-3009:fix/remove-non-null-assertions-createRegistry-seek-281

Conversation

@sridhar-3009

Copy link
Copy Markdown
Contributor

Closes #281

Both tickets[i]! occurrences in seek() are unnecessary:

  • tickets is the result of values(), typed readonly E[]
  • Neither noUncheckedIndexedAccess is enabled in the relevant tsconfig (tsconfig.dom.json base, not tsconfig.lib.json)
  • Both loops are bounds-checked (i >= 0 / i < tickets.length), so the index is always in range

Dropping the ! removes noise without any behavior change. These are the last spurious assertions in createRegistry/index.ts — the remaining ones (listeners.get(event)!, get(id)!) document genuine Map invariants and are intentionally left as-is.

Both `tickets[i]!` occurrences in the `last` and `first` loops are
unnecessary. `tickets` is typed `readonly E[]` and neither
`noUncheckedIndexedAccess` is enabled nor are the loop bounds unchecked,
so `tickets[i]` is already typed `E`. The `!` adds noise without any
runtime or type-level benefit.

Closes vuetifyjs#281
@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

commit: 7a7fd6b

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.

Remove spurious non-null assertions in createRegistry seek()

1 participant