What do you like about Dart over TypeScript? The type system in TypeScript is far superior to Dart's. Other than that, the languages are more-or-less the same.
Actually, I'm taking another look at TypeScript today. I liked it well enough when I last investigated it in 2016, but the code I wrote then was just a veneer over jQuery. I'm sure things have improved dramatically, which I am about to find out. Frankly, a Turing complete type system [1] seems like over-kill to me and a complication I don't need.
Still, Dart had everything I wanted in a front end language in 2013. I think JS devs were short sighted to reject it out of hand. It's a shame it never caught on by itself and not as a just a Flutter language. I read that Google is using it in Fuchsia so there is still a chance Dart will be big in the future! [1] TypeScript and Turing Completeness: https://itnext.io/typescript-and-turing-completeness-ba8ded8...
I highly recommend TypeScript. I don't really like the JS runtime, but, purely from a language point of view, TS is my favorite.
Some cool features: 1) Type unions interface A { a: string; } interface B { b: string; } type C = A | B; const c: C = { a: 'a' }; 2) Type assertions
if ('a' in c) { /* compiler knows c is of type A here */ } function isA(c: A): c is A { return 'a' in C } // compiler knows c is A if this returns true 3) Nice helper types
interface A { ... } ReadOnly // Like A, but all properties are read-only Partial // Like A, but all properties are optional Omit // Like A, but without 'someProp'
TBH, TypeScript's type system really impressed me. It's the strongest type system of any language I regularly use (I haven't had time to unpack Rust yet, and I learned enough Haskell to decide Haskell didn't help me solve problems I had).
Still, Dart had everything I wanted in a front end language in 2013. I think JS devs were short sighted to reject it out of hand. It's a shame it never caught on by itself and not as a just a Flutter language. I read that Google is using it in Fuchsia so there is still a chance Dart will be big in the future!
[1] TypeScript and Turing Completeness: https://itnext.io/typescript-and-turing-completeness-ba8ded8...
Some cool features:
1) Type unions
interface A { a: string; }
interface B { b: string; }
type C = A | B;
const c: C = { a: 'a' };
2) Type assertions if ('a' in c) { /* compiler knows c is of type A here */ }
function isA(c: A): c is A { return 'a' in C } // compiler knows c is A if this returns true
3) Nice helper types interface A { ... }
ReadOnly // Like A, but all properties are read-only
Partial // Like A, but all properties are optional
Omit // Like A, but without 'someProp'
Continue this thread — 3 replies