Skip to content

Commit 02865f1

Browse files
msimulcikKent C. Dodds
authored and
Kent C. Dodds
committed
fix(TS): make type parameter more specific (#247)
1 parent 8b3f767 commit 02865f1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

typings/get-queries-for-element.d.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,21 @@ export type BoundFunction<T> = T extends (
1313
: never
1414
export type BoundFunctions<T> = {[P in keyof T]: BoundFunction<T[P]>}
1515

16-
export function getQueriesForElement<T = typeof queries>(
16+
interface Query extends Function {
17+
(container: HTMLElement, ...args: any[]):
18+
| Error
19+
| Promise<HTMLElement[]>
20+
| Promise<HTMLElement>
21+
| HTMLElement[]
22+
| HTMLElement
23+
| null
24+
}
25+
26+
interface Queries {
27+
[T: string]: Query
28+
}
29+
30+
export function getQueriesForElement<T extends Queries = typeof queries>(
1731
element: HTMLElement,
1832
queriesToBind?: T,
1933
): BoundFunctions<T>

0 commit comments

Comments
 (0)