Making sense of TypeScript using set theory