Skip to content

Commit 7345e8d

Browse files
Mandurosandersn
andauthored
Add conditional return type for Clients.matchAll (microsoft#928)
* Add conditional return type for Clients.matchAll When specifically querying for clients of type window, return the specific WindowClient type. * Update baselines/webworker.generated.d.ts Use narrower `extends` test in conditional type. * Update inputfiles/overridingTypes.json Add missed source JSON update Co-authored-by: Nathan Shively-Sanders <[email protected]>
1 parent 5c690ed commit 7345e8d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

baselines/webworker.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ declare var Client: {
932932
interface Clients {
933933
claim(): Promise<void>;
934934
get(id: string): Promise<Client | undefined>;
935-
matchAll(options?: ClientQueryOptions): Promise<ReadonlyArray<Client>>;
935+
matchAll<T extends ClientQueryOptions>(options?: T): Promise<ReadonlyArray<T["type"] extends "window" ? WindowClient : Client>>;
936936
openWindow(url: string): Promise<WindowClient | null>;
937937
}
938938

inputfiles/overridingTypes.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,11 @@
26062606
"override-signatures": [
26072607
"get(id: string): Promise<Client | undefined>"
26082608
]
2609+
},
2610+
"matchAll": {
2611+
"override-signatures": [
2612+
"matchAll<T extends ClientQueryOptions>(options?: T): Promise<ReadonlyArray<T[\"type\"] extends \"window\" ? WindowClient : Client>>"
2613+
]
26092614
}
26102615
}
26112616
}

0 commit comments

Comments
 (0)