TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
Fix Element.matches strict narrowing
Fixes microsoft/TypeScript#63497.
This follows the direction discussed in that issue: matches() should only act as a type guard when the selected tag's element type is a strict subtype of the current receiver type. For tags that map back to the same receiver type, it should still be accepted but return boolean, so the false branch does not narrow the receiver to never.
Summary
- restrict
Element.matches()type-predicate overloads to strict subtype matches - keep tag-name boolean overloads for same-type matches
- regenerate DOM baselines
- add a compile-only regression fixture for the reported false-branch
neverbehavior
Validation
npm run generatenpm test- focused local TypeScript probe: the current baseline produced
Property 'id' does not exist on type 'never'; the patched baseline compiles cleanly
Thanks for the PR!
This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.
@microsoft-github-policy-service agree