Created
August 28, 2023 17:35
-
-
Save silvio2402/128508541bcd78eb9cdacc73c2923f9b to your computer and use it in GitHub Desktop.
Deserialized Type TypeScript
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
type Deserialized<T> = T extends Array<infer U> | |
? Array<Deserialized<U>> | |
: T extends string | number | boolean | |
? T | |
: "toJSON" extends keyof T | |
? T["toJSON"] extends (...args: any) => any | |
? ReturnType<T["toJSON"]> | |
: { [K in keyof T]: Deserialized<T[K]> } | |
: { [K in keyof T]: Deserialized<T[K]> }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment