Thanks @mariusschulz, I find these blog posts helpful, as someone looking to move to Typescript after a few years using React + ES6. The way you go from JS to TS in steps makes it fairly easy for me to follow along.
Glad you found my posts helpful! :)
So what type is 80 + 1? This all appears to be subtyping which I always find difficult to grok.
80 + 1
80 + 1 is not a literal, but a binary expression. A variable initialized with this value is of type number. Literal types will only be used for variables initialized with a literal:
const x = 80; // Type 80
const y = 80 + 1; // Type number
But 80 + 1 has a type, and 80 has a type and 1 has a type, so does 80 have + defined for it? Does it have implicit conversion from type 80 to type number?
The compiler automatically widens literal types if necessary. Adding two expressions of a numeric literal type or type number produces a value of type number.