4 ms·
Just to be a little picky, but if you want “convenient” then just stick with pure JS - it’s overly forgiving and simple. TypeScript is lovely and I much prefer
by phatskat 3y ago
Just to be a little picky, but if you want “convenient” then just stick with pure JS - it’s overly forgiving and simple. TypeScript is lovely and I much prefer it over JS, but having to type _everything_ is far from convenient imo
- vinceguidry 3y agoIsn't Typescript gradually typed?
- phatskat 3y agoIt is! I’ve been working in an environment that essentially requires us to type as we code (rules against using the “any” and “unknown” types) that in just used to them being enforced now lol. So I suppose my point is moot, as the tediousness isn’t forced by the language necessarily.
- rezonant 3y agoIt's also considered by many to be an antipattern to add a type that is otherwise inferred. For a trivial example, let x: number = 6; You should instead allow the compiler to infer where it can and do let x = 6; Inference doesn't work across function calls like it does (did?) in Flow, which is a good thing, so those always need to be typed. If you wanted the type of x to be 6 instead of number, you would use let x = 6 as const;