3 ms·
I find this comment validating. Most of the languages I've used start to click and feel good after a while - but it feels like this just won't happen for me wit
by Zaskoda 4y ago
I find this comment validating. Most of the languages I've used start to click and feel good after a while - but it feels like this just won't happen for me with typescript. I'm clearly missing some fundamentals and I'm not even sure what it is I need to go study.
- evandwight 4y agoWhat doesn't click? I've found it pretty intuitive, though I've explicitly avoided making complicated types.
- randomdata 4y agoThe type erasure. You get this nicely expressive type system that can encode all sorts of useful metadata, and then you have to recreate it all again by hand in 'Javascript' to access it at runtime. Say I have `type Foo = 'bar' | 'baz'` and want to validate that an input string is within the set of Foo. Why can't I just enumerate the type to determine the valid values at runtime?
- scotty79 4y agoFor me it's a great feature because it means that the code has purely javascript semantics not influenced by andy generic type magic that happens on compile time. Occasionally I bump in the same things as you when I'd like to have some JS code generated on the basis of TS type information. I think there could be some preprocessing tools that could generate JS validators on the basis of TS code. Now, trying Rust I strongly appreciate this separation. In Rust what your code DOES might depend on what you are going to do in the future with the result it returns. It's really shocking for me and makes finding errors really hard when the spot of the error messages jumps wildly across large chunk of your code as I change it. I really prefer TS philosophy of "types are for you and your text editor and the actual code is for runtime".
- soiler 4y agoCan you explain why you feel that way? I only know JS and TS, and I love TS. With both languages, I understand I'm missing out on a lot, but I kind of assumed that was normal with my level of study (that is, reading in depth to fix bugs or make new features, and generally no further).