Re:Why We Chose Typescript
by emodendroket on Saturday July 01, 2017 @09:01AM
(#14676925)
Oh yeah, that's another great point (although you're still stuck with the fact that somebody can access object properties by key).
Re:Why We Chose Typescript
by davidjnelson on Saturday July 01, 2017 @06:34PM
(#14679448)
Couldn't you solve this with privates, either via a naming convention or with symbols, as well as using getters?
Re:Why We Chose Typescript
by emodendroket on Saturday July 01, 2017 @09:45PM
(#14680318)
Not really. If I declare that an object has property xyz obj.xyz and obj['xyz'] are both valid ways of addressing it.
Re:Why We Chose Typescript
by davidjnelson on Saturday July 01, 2017 @06:33PM
(#14679442)
Absolutely. Typing is a real timesaver as it adds so much to how much an ide can help you.
Another reason i've enjoyed TS is the editor intellisense support. It's really helpful when using a library to get type info in your editor instead of having to google when you forget what a function returns, for example. This is also helpful when you're coming back to code you wrote a long time ago, or a colleague wrote it, and you don't know what particular variables/function arguments/object properties are at a given spot in the code.