Skip to content

Commit

Permalink
fix handling unknown incorrectly (fix #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Mar 13, 2024
1 parent c005bb2 commit 9c83bb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fixed handling `unknown` incorrectly. (Fix [#36](https://github.com/g-plane/typed-query-selector/issues/36))

## v2.11.1

- Fixed for TypeScript 5.4. (Fix [#35](https://github.com/g-plane/typed-query-selector/issues/35))
Expand Down
4 changes: 3 additions & 1 deletion parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export type ParseSelector<
I extends string,
Fallback extends Element = Element,
> = ParseSelectorToTagNames<I> extends string
? ExpandAnd<ParseSelectorToTagNames<I>, Fallback>
? ExpandAnd<ParseSelectorToTagNames<I>, Fallback> extends Element
? ExpandAnd<ParseSelectorToTagNames<I>, Fallback>
: Fallback
: Fallback

/**
Expand Down
2 changes: 1 addition & 1 deletion shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare global {

querySelectorAll<S extends string>(
selector: S,
): NodeListOf<ParseSelector<S> extends Node ? ParseSelector<S> : Node>
): NodeListOf<ParseSelector<S>>
}

interface Element {
Expand Down

0 comments on commit 9c83bb7

Please sign in to comment.