-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: set all default keys in FormBase to be required
reverse the schema to make form base keys optional when extending
- Loading branch information
Showing
6 changed files
with
118 additions
and
91 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
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 |
---|---|---|
@@ -1 +1,15 @@ | ||
import { DateString } from '../../shared/types/generic' | ||
|
||
export type ExtractTypeFromArray<T> = T extends readonly (infer E)[] ? E : T | ||
|
||
/** | ||
* Helper type to transform DTO types back to their serialized types. | ||
* Currently only used to cast DateStrings back to Date types. | ||
* | ||
* This is useful to transform shared DTO types back to their backend types | ||
* for typing express controller return types, relying on implicit | ||
* JSON.parse(JSON.stringify()) conversions between client and server. | ||
*/ | ||
export type DeserializeTransform<T> = { | ||
[K in keyof T]: T[K] extends DateString ? Date : T[K] | ||
} |