3 ms·
I love typescript as a JavaScript developer, but having used go for personal projects, I find the type system complex (maybe necessarily so). Having said that,
by Karupan 8y ago
I love typescript as a JavaScript developer, but having used go for personal projects, I find the type system complex (maybe necessarily so). Having said that, I cannot thank TS enough for how it’s made life easier when working on and refactoring large codebases.
- smt88 8y agoI don't know what you find complex about the type system, but I actually find it slightly limiting. They keep improving it, so it can express about 95% of what I want, but I still hit situations where I can't tell the compiler everything.
- MuppetMaster42 8y agoI'm the same. Anything I do, I make sure it's in typescript because I find it easier to write than standard js. Generics are a complex concept for people to grasp without some time playing and reading docs, but once you learn it, you can express almost everything you want. But for simple projects you can get away with all but the most basic of generics, if any at all. With the release of conditional types, I find most of my js typing cases are covered. Though tbh I've always leant toward the side of "if you can't express it easily, then you're being to JavaScripty".
- bcherny 8y agoWhat sorts of things do you have trouble expressing with the type system?
- smt88 8y agoI can't think of something off the top of my head, but it's usually related to generics. I'll type something that makes sense, but the compiler doesn't like it. Another issue is that handling of string literals as types can be wonky when they're being compared against the type "string", which they should always satisfy but sometimes don't.
- bcherny 8y agoI’d love to see examples for those, maybe drop a comment when you run across a specific issue.
- Karupan 8y agoMy comment was in the context of having used Golang. It maybe a personal experience as I primarily come from dynamic, weakly typed languages, and TypeScript and Golang are my first serious foray into typed languages.
- tapirl 8y agosame feeling. I tried to use TS for several times, but it looks its type system is too complex. So I'm still sticking to old JavaScript now (before ES5) for the simplicity.