Would be so cool if the js engines ignored types like python3. Then I could just write Typescript and run it on node/browser
Announcing TypeScript 2.1
51–60 of 226 posts
Re: Announcing TypeScript 2.1
#52If you still haven't given TypeScript a go as a Javascripter, now is a great time to do so. Whether you end up adopting it or not, it's interesting to get the types out of your mind and into the code. The first time you feel the speed/confidence of refactoring with accurate 'Find usages', you'll decide if the undeniable overhead of types is worth it.
Re: Announcing TypeScript 2.1
#53I like the functionality of let merged = { ...foo, ...bar, ...baz }; But I've come to understand ... as variadic parameters in C++, Java and Go. Wish they'd used another token.
Re: Announcing TypeScript 2.1
#54Re: Announcing TypeScript 2.1
#55Still no VS 2013 support? We're stuck on 1.8 for a while. It would be great if they supported VS 2013 at least until they release 2017.
Re: Announcing TypeScript 2.1
#56The easier imports solves my biggest issue with migrating an existing project over. I'd say TypeScript is "ready" now. The last feature I'd want is an easy way to map nested json into classes rather than interfaces. Anyone know how?
abstract class AbstractClassObject {
constructor(json?: any){
if (json){
this.updateFromJSON(json)
}
}
public updateFromJSON = (json: any): this => {
Object.assign(this, json);
return this;
}
}
That gives you the "magic" just by extending the base, while also allowing custom behavior for a given class (by overriding updateFromJSON).Re: Announcing TypeScript 2.1
#57Feels like Typescript is building (or has built up?) more momentum than Flow.
Re: Announcing TypeScript 2.1
#58I like the functionality of let merged = { ...foo, ...bar, ...baz }; But I've come to understand ... as variadic parameters in C++, Java and Go. Wish they'd used another token.
let a = [1, 2, 3];
Math.max(...a); // 3
If you use that operator in parameters, it's rest (i.e. variadic stuff). function sum(...numbers) {
return numbers.reduce((a, b) => a + b, 0);
}
sum(1, 2, 3, 4, 5); // 15Re: Announcing TypeScript 2.1
#59One thing I never understood with Babel is which features are shimmed in the output JS and which features are re-implemented? What I means is: I didn't know how to tell Babel which browsers I was targeting, and I'm pretty sure that some of their feature implementations do not feature test the platform before activating, since they were so compiled in. Is that the case? Also, do you have to tell TypeScript your target…
(I'm working on it so let me know if you have questions)
Re: Announcing TypeScript 2.1
#60It's interesting to me that all of the initial reactions I've seen to this announcement have been around the introduction of async and object spread, which are available with babel, but the typescript specific features such as mapped types are completely ignored. I don't really have any particular meaning behind that observation, only that it tickled my funny bone a little bit.
Maybe it is me, but I feel like mapped types and keyof are terrible features, and using them would be a sign of a bad design/architecture. In general, I don't think using a string that represents a static symbol (such as the name of a var, an attribute or a class) is a good idea. I try to keep a simple stack (Typescript + NPM at the moment), and I prefer to wait for Typescript to have the feature I want, than to inst…
These are two very different styles of programming, and TypeScript does a fairly good job of serving both groups--it would have to, in order to be as successful as it is. There are a ton of useful JavaScript libraries out there which couldn't easily be rewritten to conform to some Java-style type system, and there are a ton of skilled Java/C#/C++ engineers out there who don't want their name on a bunch of cowboy code.
I don't think this cultural division is going to go away any time soon, so it's in our best interest to believe that people in the "other camp" (whichever camp that is) are skilled and conscientious developers. I'm sure you've heard the arguments by dynamic language lovers who talk about how restrictive/slow/painful it is to write in a static type system, and I'm sure you're as tired of that argument as I am.