-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏷️ Fix typing of request & streaming request
- Loading branch information
1 parent
1a43527
commit 24e8a27
Showing
6 changed files
with
114 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// https://dev.to/safareli/pick-omit-and-union-types-in-typescript-4nd9 | ||
// https://github.com/microsoft/TypeScript/issues/28339#issuecomment-467393437 | ||
/** | ||
* This allows omitting keys from objects inside unions, without merging the individual components of the union. | ||
*/ | ||
|
||
type Keys<T> = keyof T; | ||
type DistributiveKeys<T> = T extends unknown ? Keys<T> : never; | ||
type Omit_<T, K> = Omit<T, Extract<keyof T, K>>; | ||
|
||
export type DistributiveOmit<T, K> = T extends unknown | ||
? keyof Omit_<T, K> extends never | ||
? never | ||
: { [P in keyof Omit_<T, K>]: Omit_<T, K>[P] } | ||
: never; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters