Review 14.3 Merged

97075[TASK] Type DOM query results via type arguments

Benjamin Kott CR +2 V +2 Hard +302 −302 updated 10/23/26, 12:27

Commit message

Calls to querySelector() and closest() name the expected element type
as a type argument instead of a type assertion, and querySelectorAll()
does the same for its NodeListOf. Where a plain tag-name selector
already infers the type, the type and a variable annotation repeating
it are dropped.

On a selector that does not name the tag, such as a class or attribute
selector, the type argument is the same unchecked downcast the
assertion was. Narrowing these or checking the element is left to
follow-up patches.

The difference is null: the assertion removed it from the result, the
type argument keeps it. Without strictNullChecks the types are the
same. With it, a use without a null check would be reported instead of
hidden. This change adds no null checks.

Findings of the ESLint rule
@typescript-eslint/no-unnecessary-type-assertion drop from 394 to 92.

Review

  • Code review CR +2 Done
    • Benjamin Kott +2
  • Verified V +2 Done
    • Benjamin Kott +2
    • core-ci +1 CI

Issues 1

Files 98

Show 78 more files

Review log 57

  1. Benjamin Kott commented on patch set 1 10/23/26, 12:07

    Cherry Picked from branch main. The following files contain Git conflicts: * Build/Sources/TypeScript/backend/form-engine/element/extra/item-count.ts * Build/Sources/TypeScript/workspaces/backend.ts
  2. Benjamin Kott uploaded patch set 2 10/23/26, 12:10

  3. Benjamin Kott commented on patch set 2 10/23/26, 12:12

    This change is ready for review.
  4. core-ci voted on patch set 1 V -1 10/23/26, 12:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112289

  5. core-ci voted on patch set 2 V +1 10/23/26, 12:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112290

  6. Benjamin Kott voted on patch set 2 CR +2 V +2 10/23/26, 12:27

  7. Benjamin Kott merged patch set 3 10/23/26, 12:27