News for hackers. Stuff that matters.
Re:First look: adding type annotations to JavaScript by markstos on Thursday March 10, 2022 @09:57AM (#30627602)
Are you saying that if there had been type checking, this issue would have been much easier to detect and prevent?
Re:First look: adding type annotations to JavaScript by jaywalk on Thursday March 10, 2022 @10:27AM (#30627940)
How could it not be? With type checking, you wouldn't be able to set a variable to a number when it's supposed to be an object.
Re:First look: adding type annotations to JavaScript by simion314 on Thursday March 10, 2022 @01:25PM (#30630483)
Yes a line like

stuff.anAccountTypeField = obj.aNumberValue;

Would cause an error in a typed language , something like incompatible type Number and type Account.

Maybe you were confused by my commnet about the network requests and different order of running code, this caused the error not to happen most of the time so it never crashed on developer machine.