3 ms·
> I do not believe that you can write perfect code or avoid bugs. I don't think anyone (including you) does. I don't think typescript pretends to be a perfect
by CapsAdmin 7y ago
> I do not believe that you can write perfect code or avoid bugs.
I don't think anyone (including you) does. I don't think typescript pretends to be a perfect programming language that magically creates clean code either, but I think it gets us closer to that unrealistic goal.
> This again, depends on the particular history and skill-set of your team. For example, TypeScript fits very well if you are familiar with C#.
I very much disagree with this.
If you want to compare Typescript with another language, you have to remember that its typesystem is optional. So all you are left with basically Javascript. How much of the typesystem you want to use is up to you and your team.
Personally I try to let typescript infer the types as much as possible. I only explicitly annotate function arguments and foregin data.
Sometimes there are cases where the typesystem won't work. Usually it's because I want to dynamically create something instead of verbosely defining everything. If the dynamic way is easier to maintain I choose that way and may lose some type information. (often you can tell the typesystem that "this dynamic blob" results in "this explicit type" though)
I'm not very fond of C# but I enjoy Typescript. I think the reason I don't like C# is because it forces you to make classes of everything which to me adds a lot of friction.
- orange8 7y agoTS may compile down to JS, but that does not make it the same language. TS done the proper idiomatic TS way is just very different from JS done the proper functional + dynamic way. How you structure your code using a dynamic, functional language should be very different from how you structure your code in a static, object oriented language. If your code structure looks more or less just the same between the two, then you are doing one of them wrong. > you have to remember that its type system is optional Doesn't opting out of the type system defeat the purpose of using TYPE-script in the first place?
- CapsAdmin 7y ago> TS done the proper idiomatic TS way is just very different from JS done the proper functional + dynamic way. Where do you get the idea that Typescript code should be structured like a static object oriented language? Is it because it's a Microsoft product? Letting Typescript try and figure out the types while coding in a "dynamic and functional way" is what works best for me. Is this wrong?
- orange8 6y agohttps://github.com/gcanti/fp-ts https://github.com/gcanti/fp-ts