Created
February 20, 2021 14:55
-
-
Save aiya000/d5b18b62ba520d4728439c8f89cfb291 to your computer and use it in GitHub Desktop.
証明できてる?
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
/** | |
* Proves that A and B is the same types. | |
*/ | |
export type Equal<A, B> = A extends B ? (B extends A ? true : never) : never | |
/** | |
* Makes all fields of A to `<its-type> | null`. | |
*/ | |
export type Nullable<A extends Record<string, unknown>> = { [K in keyof A]: A[K] | null } | |
const _proofNullable: Equal<Nullable<{ x: string }>, { x: string | null }> = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment