DEV Community

Discussion on: Keep Your Types And Interfaces Closer (In TypeScript)

Collapse
 
antjanus profile image
Antonin J. (they/them)

good question! I think those two types are too vastly different to be in a union type and be useful.

I'd probably split it out to be productId: string and product: Product and just convert one to the other if necessary.

Collapse
 
akshatbhargava123 profile image
Akshat

Okay I got it, thank you sir.