Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create a type to remove the fields with a certain type
- Loading branch information
luis.cabo
committed
Mar 18, 2023
1 parent
62bf680
commit 936e0dc
Showing
3 changed files
with
12 additions
and
4 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,8 @@ | ||
// With this util we could remove the keys with never type from the original type. | ||
type KeysWithoutType<T, Type> = { | ||
[K in keyof T]: T[K] extends Type ? never : K; | ||
}[keyof T]; | ||
|
||
export type RemoveFieldsWithType<T, Type> = { | ||
[K in KeysWithoutType<T, Type>]: T[K]; | ||
}; |