That’s TypeScript’s whole point. It’s not for the computer, it’s for the programmer. It’s to avoid you assigning a string to something you elsewhere assume to contain a number. In Typescript, there’s just no solution for this, except requiring the programmer to specify the type. It can’t be inferred flawlessly.
Yeah that’s what I’m saying, I hate it when coworkers will assign everything as “any” just to avoid the scary red squigglies. Oh well I guess that’s what code reviews are for 🙃
That’s TypeScript’s whole point. It’s not for the computer, it’s for the programmer. It’s to avoid you assigning a string to something you elsewhere assume to contain a number. In Typescript, there’s just no solution for this, except requiring the programmer to specify the type. It can’t be inferred flawlessly.
Yeah that’s what I’m saying, I hate it when coworkers will assign everything as “any” just to avoid the scary red squigglies. Oh well I guess that’s what code reviews are for 🙃