Skip to content

Commit 299d245

Browse files
Lewenhauptkuhe
andauthored
fix(types): extends check of generic in WithSdkStreamMixin (#4119)
* fix(types): Fix issue with WithSdkStreamMixin Fix an issue where WithSdkStreamMixin would apply to more properties than intended due to Distributive Conditional Types. * fix(streams): apply mixin only to key match instead of type match * fix(streams): update docs to indicate single key match instead of type match Co-authored-by: George Fu <[email protected]>
1 parent ea98484 commit 299d245

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/types/src/serde.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ export interface SdkStreamMixin {
8787
export type SdkStream<BaseStream> = BaseStream & SdkStreamMixin;
8888

8989
/**
90-
* Indicates that any members of type T
91-
* that were of type T[StreamKey] have been extended
90+
* Indicates that the member of type T with
91+
* key StreamKey have been extended
9292
* with the SdkStreamMixin helper methods.
9393
*/
9494
export type WithSdkStreamMixin<T, StreamKey extends keyof T> = {
95-
[key in keyof T]: T[key] extends T[StreamKey] ? SdkStream<T[StreamKey]> : T[key];
95+
[key in keyof T]: key extends StreamKey ? SdkStream<T[StreamKey]> : T[key];
9696
};
9797

9898
/**

0 commit comments

Comments
 (0)