|
After reading so much about it, I decided to give a try to TypeScript. I needed to write a large single page webapp, so instead of writing it in C# and compiling to JavaScript (with the Saltarelle compiler), I opted to give a try to TypeScript. After all, everybody was describing an experience similar to C# or Java, so I thought, why not?
I struggled one day converting an existing C# application making it work in Typescript. At the end of the day I just gave up, realizing it's not what I was looking for (that is, a language that hides all the JavaScript annoyances).
What made me renounce:
- Intellisense sometimes slows down the Visual Studio editor, some other times stops working completely
- Syntax highlight is very basic, e.g. there is no special color for type names, or other semantic elements
- I really hate the ": type" syntax, it made me remember of old pascal days. You can get used to it, but you keep asking WHY??
- Autocompletion works only with the tab or enter key (and not with other symbols like (,= as in C#)
- class implementation lacks all the important features: operator overloads, extension methods and all the rest
- I found that comparing two equal "Date" variables with "==" (and not "===") results in false! Ok, it's due to JavaScript but that's horrible.
- Sometimes the compiler exits with an error without telling you what the error is, just "tsc.exe exit code 1".
- When generating a single global .js file, the compiler doesn't handle class inheritance (what class comes first), so you have to stick with multiple file only.
- Within a class, you have always to refer to "this", it's not optional like in C#. Sometimes it's annoying.
- Found myself often going to CodePlex and discovering it's a known issue
Of course there are good points too:
- debug directly within Visual Studio (break points and all the rest)
- has import types for many javascript libraries (DefinitelyTyped)
- Compared to C#, the dynamic syntax is much nicer for objects (no "new" keyword) and arrays
- I like how interfaces are handled and also the "optional" members (though I dislike the "name?" syntax)
Overall, I would strongly suggest TypeScript only to existing JavaScript users. Developers coming from the Java/C# world are more likely to be disappointed, for them the "Dart" language is more appropriate (but sadly there is no Visual Studio plugin yet).
If you have tried TypeScript, what was your experience?
modified 24-Apr-14 9:38am.
|
|
|
|
|
Thanks for sharing. I am no TypeScript user, but it is great to have such kind of posts back in the Lounge.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
Thanks for taking the time to provide a great summary of your experience.
I have not tried TypeScript for some of the reasons you mention -- I am a C# dev and have been working with JavaScript (jQuery and now Angular) for the past 2 years or so. About 2 months ago I went out to the typescript site and checked it out and couldn't find enough reason, just from reading the docs to learn yet another syntax and compiler operation.
Maybe if you've never even touched JavaScript, but then you'd probably still be lost.
Thanks again.
|
|
|
|
|
Talking of C# and AngularJS, an alternative is to cross-compile C# to JavaScript (with compilers like Saltarelle). I have some projects written this way, but it's not an optimal solution because:
- you need a C# import library for Angular (that I've written myself but it's hard to cover all the package)
- Angular itself is very JavaScript oriented, with lot of hacks and tricks, doesn't fit well with C#
- At this point there is no Visual Studio integrated debugging for C#, you can only debug compiled JS code
- working with json and js in general, in C# you find yourself fighting with types, doing lot of conversions and things like that. The dynamic keyword helps but not much.
|
|
|
|
|
"Toms Cruise, Selleck and Courtney? I'll pass!"(2,6)
Nice!
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
No thanks or maybe not hanks.
One day I aspire to having a signature.
|
|
|
|
|
Very Good, and very quick!
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
Not quite so busy today
One day I aspire to having a signature.
|
|
|
|
|
Great clue, BTW.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
Dalek Dave wrote: Nice!
Very!
|
|
|
|
|
Movie Quote Of The Day
Live long and prosper
Which movie?
Tip: The guy always seems to pray to me
|
|
|
|
|
Y'know, bad punctuation really pisses me off.
It should be Live, Long, and Prosper; it's one of those "greed is great!" Wall Street clone movies.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
|
The Money Pit
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Star Wars ?
I will get my coat.
Whether I think I can, or think I can't, I am always bloody right!
|
|
|
|
|
And that's how the war began
|
|
|
|
|
|
Yes, and I can assure you that was totally deliberate
|
|
|
|
|
That's what my parents told me when they kicked me out of ourtheir home.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
Well, that's what I told my parents when I left home.
Don't mind those people who say you're not HOT. At least you know you're COOL.
I'm not afraid of falling, I'm afraid of the sudden stop at the end of the fall! - Richard Andrew x64
|
|
|
|
|
[mode="Emo Philips"]
When I was 14 my parents moved home. I wish I knew where they went.
[/mode]
|
|
|
|
|
The Old Testament[^] ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
Debbie Does The Dalai Lama?
Anything that is unrelated to elephants is irrelephant Anonymous ----- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944 ----- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
Robinhood
Don't mind those people who say you're not HOT. At least you know you're COOL.
I'm not afraid of falling, I'm afraid of the sudden stop at the end of the fall! - Richard Andrew x64
|
|
|
|
|