3 ms·
When I said knowing implicitly I was referring to for example, declaring that class `Foo` has an integer property `prop`, and function `bar` only accepts an ins
by stephenr 6y ago
When I said knowing implicitly I was referring to for example, declaring that class `Foo` has an integer property `prop`, and function `bar` only accepts an instance of `Foo` as argument `obj`, thus `obj.prop` is always an integer. The developer doesn’t need to add typeof checks on the argument, on the property, etc.
The above comments point to (a) not using classes or declared properties at all, and regardless JavaScript has no support for automatic type checks on properties or function arguments.