2 ms·
Or... You could use Typescript :) . I'm a fan of C# language design and Typescript was designed by the same guy (and Delphi). If you like C# you should try it,
by slackingoff2017 9y ago
Or... You could use Typescript :) . I'm a fan of C# language design and Typescript was designed by the same guy (and Delphi).
If you like C# you should try it, to me its truly magical.
To get the full experience make sure you turn on every strict option in the compiler then almost every option in TsLint. Without them it will still allow you to write a lot of hacky stuff.
I recently setup a project this way to get a group of old-school webforms programmers into front end JS development. It provides a great set of "training wheels". The framework situation still sucks but it makes the coding part painless.
What does this typescript+linting setup prevent? Bad casts, unsafe uses of "this", using var, non-boolean values in conditional statements, conditionals that always return true/false, old "for-in" loops, missed checks for null and undefined. The list goes on.
Things directly related to your post: no unsafe closures, full lambda support with polyfill, access modifiers. It's also extremely good at type inference, much better than C# or any other languages I've used. For example, you never need to specify a return type because Typescript can always infer it based on your return statements.
The thing with Typescript is that it's a superset of JavaScript. You don't lose anything you like but you get a lot of things you probably enjoy in C#. And it's designed to compile down to idiomatic JavaScript. If you decide "no more typescript" some day, you compile one more time to ES6 and it's gone.
Sorry to be so rabid about it but I'm largely a C# programmer too and Typescript made context switching between the two effortless. The design similarities to C# are unmistakable