DEV Community

Discussion on: Tossing TypeScript

 
blueharborbrandon profile image
BlueHarborBrandon

I mean that a type in TypeScript represents a set, like you learned about in math class. Like the set of all integers is a subset of the set of all real numbers. In TypeScript, the type string is a set that contains every string, but no numbers or functions or anything else. That's why you can pick out string literal types and union them together, but it's also why you can pseudo-extend a type by creating its intersection with another type.