3 ms·
Why do you need types to learn React? You really need a compiler to tell you when you have made a mistake that bad? Your first mistake is trying to add typing
by iamleppert 5y ago
Why do you need types to learn React? You really need a compiler to tell you when you have made a mistake that bad?
Your first mistake is trying to add typing on a dynamic language that works just fine without types. You won’t really learn the underlying language that well that way, and you therefore won’t have a good understanding of it.
TypeScript makes sense in large projects, with many developers where you need to catch a class of problems that compile time type checking can catch. It doesn’t offer a lot or add much in the way of actually learning the fundamentals of frontend development and is a distraction when viewed through that lens.
Are you sure you weren’t actually avoiding the scary unknowns of actual learning and doing a bunch of busy work to bring familiarity into an otherwise unfamiliar space? I catch myself doing that a lot, especially if I need to learn a completely new language to learn something. I wasted a lot of time trying to make OpenCV work with native JavaScript when I should have just learned enough C++ to get by.
- programmarchy 5y agoI used to think like this, but TypeScript has saved me massive amounts of time. If you ever refactor your code, the compiler will help you trace all the dependencies, so you don't end up with subtle bugs or broken code. In other ways, TypeScript deepens understanding of JavaScript. For example, TypeScript forces you to think explicitly about the differences between undefined and null, helping you to know the difference and to avoid a whole class of JavaScript pitfalls. You can also look at a function signature and know exactly what inputs and outputs it requires, rather than having to memorize or search docs. Even for smaller projects, I start with TypeScript now.