1

I need to create an object from an interface which extends from another interface, but I need to set all the parents' properties and they are a lot of. Is it possible to make them optional?

Example:

interface Auto {
    radio: any;
}
interface Mazda extends Auto {
    // mazda properties
}
const m = <Mazda>{
   // just mazda properties 
}

Actually I need that the parent properties mappend on the son to be optional, with Partial would be needed to create a property containing a parent object, but I want to extend and to have all the extended properties as optional.

  • `Partial & Pick>` ? – jcalz Nov 08 '18 at 20:22
  • Possible duplicate of [Make all properties within a Typescript interface optional](https://stackoverflow.com/questions/39713349/make-all-properties-within-a-typescript-interface-optional) – Heretic Monkey Nov 08 '18 at 20:22
  • I think if you want a more meaningful answer, you'll need to flesh this question out into a full [mcve], including how you intend to use the type. – jcalz Nov 09 '18 at 00:33

0 Answers0