3 ms·
"At the very least, identifiers should not be allowed to float freely as strings or integers in order to prevent a class of inconsistency bugs." Tell that to a
by nesarkvechnep 6y ago
"At the very least, identifiers should not be allowed to float freely as strings or integers in order to prevent a class of inconsistency bugs."
Tell that to almost every Typescript developer who uses `number` for identifiers.
- crooked-v 6y agoTypescript doesn't have functionality for non-equivalent types with identical primitives or interfaces (e.g. you can't have string-equivalent type A ≠ string-equivalent type B), though there's ongoing discussion around adding it (https://github.com/Microsoft/TypeScript/issues/202 https://github.com/Microsoft/TypeScript/issues/202).
- 0xdeafcafe 6y agoArctic take.
- hermanradtke 6y agoThat is why we use things like io-ts. t.Int is a branded type that ensures number is whole and greater than 0.