loading...

re: TypeScript: type vs interface VIEW POST

TOP OF THREAD FULL DISCUSSION
re: One more thing: as I said interface allows extension even after declaration, so it would be possible extend interface exposed by 3-rd party library...
 

An example where you'd want to extend the interface of a 3rd party API is OrderCloud. They have the property xp to enable you to extend their data model. Here's an example of a type where xp is object (I think sometimes it's any too).
And the extension would be something like:

interface OrderExtended extends Order {
    xp: OrderXp | null
}
export interface OrderXp {
  isCool: boolean
  isAwesome: boolean
  maybeIsBoth: boolean
}
Code of Conduct Report abuse