Last active
September 20, 2022 05:19
-
-
Save hmmhmmhm/39922d389eb4b00a9c320e0f0af97d85 to your computer and use it in GitHub Desktop.
Remove some depth of typescript interface
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
interface T1 { | |
name: string; | |
email: string; | |
properties: { | |
creators: [{ | |
name: string; | |
}]; | |
color: string; | |
} | |
} | |
type Overwrite<T, U> = { [P in Exclude<keyof T, keyof U>]: T[P] } & U; | |
type T7 = Omit<T1, "properties"> & { properties: Omit<T1["properties"], "creators"> }; | |
type T8 = Overwrite<T1,{properties: {color: string}}>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment