TypeScript 2.1 RC: Better Inference, Async Functions, and More
blogs.msdn.microsoft.com
blogs.msdn.microsoft.com
Better type inferencing of course makes writing code better for everyone.
Also, somewhat buried in this announcement is showing off support for more modular lib.d.ts support, which is also something that has been patiently needed. (Up to now the basic types and expectations of the target ES version you were transpiling to were in big monolithic definition files making it harder to "pick and choose" as needed for your project: the most common case being one shown here that most browsers support native promises from ES2015 and/or are easily polyfilled, but you still want to mostly stick everything else to ES5 output code for the time being.)
It surprised me that async didn't seem to work by default in react-native because their documentation stated support for it very plainly. Maybe it's because I was on Windows or because I am using Node v4.
Thanks for the offer but I will probably continue to slog through this on my own. I'm really just getting started with React even though I've been reading about it forever. I don't know TypeScript very well either but maybe I will start learning!
Sincerely, Microsoft, bravo!
interface Color {
isRed: boolean,
name: string
}
function example(): Color {
let x = {};
x.isRed = false;
x.name = "Cerulean";
return x;
}
Obviously you'd just build the object at once for something this simple, but for larger/more complex objects it becomes trickier.