I have two types one inherits all the properties of other so I rewrite them all on the child. Is there a shortcut way to write this?
type Parent = {
a: string,
b: string
}
type Child = {
a: string,
b: string,
c: number
}
I have two types one inherits all the properties of other so I rewrite them all on the child. Is there a shortcut way to write this?
type Parent = {
a: string,
b: string
}
type Child = {
a: string,
b: string,
c: number
}
Based on Possible to extend types in Typescript?
You can do like this :
type Parent = {
a: string,
b: string
}
type Child = Parent & { c: number }