-1

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
}
eguneys
  • 6,028
  • 7
  • 31
  • 63

1 Answers1

0

Based on Possible to extend types in Typescript?

You can do like this :

type Parent = {
  a: string,
  b: string
}

type Child = Parent & { c: number }
Marco
  • 1,073
  • 9
  • 22