2.1 has plenty more including sharing tsconfig.json options, better support for custom elements, and support for importing helper functions, all which you can read about on our wiki.Īs always, we’d love to hear your feedback, so give 2.1 a try and let us know how you like it! Happy hacking! We believe TypeScript 2.1 is a full-featured release that will make using TypeScript even easier for our existing users, and will open the doors to empower new users. If that’s not desirable, you can opt in to the old behavior with -noImplicitAny, which we actually recommend for all new TypeScript projects. We decided that TypeScript needs to be more trusting, and in TypeScript 2.1, so long as you have a package installed, you can use it.ĭo be careful though – TypeScript will assume the package has the type any, meaning you can do anything with it. So we focused on on that one core expectation:īut I already have that package installed!Īnd from that statement, the solution became obvious.
#Documentdb emulator mac code#
And while you can still compile & run your code in spite of those errors, those red squiggles can be distracting while you edit.
#Documentdb emulator mac install#
Npm install -save this was a consistent point of friction for developers. The problem is that TypeScript didn’t trust the import since it couldn’t find any declaration files for lodash. “But I already have that package installed!” you might say. Unfortunately, it’s pretty common that as soon as you import something you’ll get an error. However, a lot of the time, you might just want to write a quick script and get TypeScript’s editing experience. This was to avoid typos and prevent users from using packages incorrectly. TypeScript has traditionally been a bit finnicky about exactly how you can import something. You can actually see how these types are implemented within lib.d.ts itself. We’re also including two other utility types as well: Record and Pick. However, because the Partial and Readonly types we used above are so useful, they’ll be included in TypeScript 2.1. Now that TypeScript has mapped types, no special support has to be built into the language for partial.
#Documentdb emulator mac update#
This was useful for performing partial updates to values, like when using React‘s setState method to update component state. Originally, we planned to ship a type operator in TypeScript 2.1 named partial which could create an all-optional version of an existing type. Likewise, instead of repeating ourselves with FrozenPerson, we can just write Readonly! Partial, Readonly, Record, and Pick So instead of defining a completely new type like PartialPerson, we can just write Partial.
Notice how we leveraged TypeScript 2.1’s new indexed access types here by writing out T. Keep types the same, but make each property to be read-only. Keep types the same, but make every property optional. With object spreads, making a shallow copy of an object has never been easier: The feature is already used quite a bit when using libraries like Redux.
Object rest & spread is a new proposal for ES2017 that makes it much easier to partially copy, merge, and pick apart objects. We’ve been excited to deliver object rest & spread since its original proposal, and today it’s here in TypeScript 2.1. We’re pleased to say that after several months of testing, neither have been impacted, and that TypeScript users should continue to enjoy a stable speedy experience. Keeping parity meant not just that existing emit didn’t change, but that TypeScript’s emit speed was on par as well. It bears repeating: downlevel async functions have arrived! That means that you can use async/ await and target ES3/ES5 without using any other tools.īringing downlevel async/ await to TypeScript involved rewriting our emit pipeline to use tree transforms. We’ve written previously about some great new things 2.1 has in store, including downlevel async/ await and significantly improved inference, in our announcement for TypeScript 2.1 RC, but here’s a bit more about what’s new in 2.1. Visual Studio Code will usually just prompt you if your TypeScript install is more up-to-date, but you can also follow instructions to use TypeScript 2.1 now with Visual Studio Code or our Sublime Text Plugin. You can also grab the TypeScript 2.1 installer for Visual Studio 2015 after getting Update 3.