Created
October 15, 2019 17:10
-
-
Save aneurysmjs/034cbdc97d0e902e7f637bf2a6ee114e to your computer and use it in GitHub Desktop.
types vs interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Base { | |
id: string; | |
timestamp: string; | |
} | |
interface Product extends Base { | |
price: number; | |
stock: number; | |
} | |
// type aliases can't be extended but can be interfered | |
type Product { | |
price: number; | |
stock: number; | |
} & Base; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment