With TypeScript 2.2, null checking is improved even further. TypeScript now flags expressions with nullable operands as compile-time errors.
TypeScript 2.2 loosens a restriction around dotted property access for types with explicit string index signatures. Fewer type annotations, less awkward code!
TypeScript 2.2 introduces a new type called
object which represents any non-primitive type. Don't confuse it with the existing
TypeScript 2.1 makes it a lot easier to work with untyped imports. Previously an error, these imports are now typed as
any and can be consumed painlessly.
TypeScript 2.1 differentiates between widening and non-widening literal types. Here's the difference between the two.
TypeScript 2.1 improves inference for literal types. Constant variables and read-only properties with literal initializers are now inferred to be of a literal type.
TypeScript 2.1 introduced mapped types, a powerful type system feature which allows you to create new types from existing ones by transforming properties.
TypeScript 2.1 introduces the
TypeScript 2.1 adds support for object rest and spread. You can work with rest/spread properties in a type-safe manner and downlevel both features to ES3.
TypeScript 2.1 adds a compiler option for importing helper functions from an external library. The helpers aren't injected into every file, resulting in smaller bundle sizes.
TypeScript 2.1 adds support for downleveling asynchronous functions to ES3/ES5. That way, you can run your
In TypeScript, there are multiple syntaxes for typing a function: method signatures, function type literals, and object type literals with call or construct signatures.
TypeScript 2.0 adds a "lib" compiler option that gives you more granular control over which built-in API declarations to include in your project.
TypeScript 2.0 introduces a new primitive type called "never", the type of values that never occur. It helps model the completion behavior of functions more accurately.
TypeScript 2.0 introduces more literal types. In addition to string literal types, we can now declare boolean, numeric, and enum literal types.
TypeScript 2.0 implements tagged union types, a special kind of union types that share a common property. Here's how you can use them in practice.
In TypeScript 2.0, the
readonly modifier was added to the language. It provides compile-time checking for unintended property assignments.
I'm excited to announce TypeScript Weekly, a weekly e-mail round-up of news and articles from the TypeScript community.
TypeScript 2.0 implements control flow based type analysis to determine the most specific type for a variable or parameter at any given location. An explanation.
TypeScript 2.0 adds support for non-nullable types, which help prevent an entire category of nullability errors at compile-time.
TypeScript allows us to specify multiple types for the same function. That way, we can accurately describe all possible overloads to the type system.
TypeScript can now independently transpile module formats and language targets. This way, Rollup can bundle ES2015 modules with ES5 code.
The destructuring syntax introduced by ECMAScript 2015 doesn't have to be used to declare new local variables. Plain assignments are supported, too.
Visual Studio Code lets you specify which TypeScript version to use for tooling. Here's how to install a nightly build of TypeScript within a workspace.
TypeScript uses the
The logical operators
Using a custom convention, the
Date instances by default.
TypeScript 1.8 introduced string literal types, which allow for describing a set of possible string values for a given variable. Here's how to use them.
This post gives you some suggestions as to how to get started using the new ECMAScript 2015 features in your projects.
ECMAScript 5 introduced many useful array methods. Two lesser known of them,
every(), are explained in this post.
Array.prototype.includes method will be included in the upcoming ECMAScript 2016 specification. Here's how it works.
const keyword declares a constant variable. However, its value can still change since it's not immutable. A clarification.
TypeScript 1.6 introduced the
--init flag for the
tsc executable to make it easier to set up new TypeScript projects. A short summary.
ECMAScript 2016 will likely standardize the exponentiation operator
**. Babel and TypeScript 1.7 already support it today.
ECMAScript 2015 allows a function to immediately destructure an object parameter. Here's the TypeScript syntax for typing the destructured properties.
System.Web.Optimization framework using ASP.NET MVC.
Here's how to inline Angular view templates into the page HTML for better performance using ASP.NET MVC and Razor.
Here's how to use Babel to transpile npm packages written in ECMAScript 2015.
TypeScript 1.5 has been released and ships with excellent ECMAScript 2015 support. Check out this new version and start using ECMAScript 2015 language features today.
Destructuring assignments work perfectly together with regular expression matches as returned by the
exec function. Pattern matching helps assign matches and captures to local variables.
Here's how to return an object literal from an expression-bodied arrow function as introduced by ECMAScript 2015.
Learn how to use the
ng-strict-di attribute to detect unminifiable Angular code. It puts the dependency injector into strict mode to fail fast and fail early.
Here's a compilation of my favorite session recordings from Build 2015. They're all about ASP.NET 5, C# 6, and TypeScript.
Lodash implements implicit function chaining, which allows you to write function chains without calls to
_.value. This allows for a concise and readable expression of typical map/reduce transformations.
The popular Lodash library will be even more natural to use with ECMAScript 2015. New language features like pattern matching, array destructuring, and arrow functions allow for writing terse yet readable code.
You can use the
merge-stream package to combine multiple gulp streams into a single stream that can be returned from a gulp task.
Lodash defines two functions,
_.merge, for combining properties of multiple objects. Which one should be used for merging settings objects?
Angular 2 will be built on TypeScript, and the AtScript and TypeScript languages have been converged. Here's my take on this development.
Bundling and minifying a website's scripts and stylesheets reduces page load time and asset size. Here's my project setup for bundling and minifying scripts of an AngularJS application hosted within an ASP.NET MVC site.
This is an introduction to bundling and minification, two techniques which help improve a website's performance by reducing page load time and asset size.
Learn how to keep your browser console organized by grouping related log messages using modern browsers' debugging tools.
Learn how you can manually bootstrap AngularJS applications and initialize them with asynchronously loaded JSON data.
The popular Underscore.js library recently enhanced its capabilities to deal with partially applied functions. Starting with version 1.6.0 which was released in February 2014, the _.partial function is now a lot more flexible and allows for some interesting use cases.
Many AngularJS applications require initial data on startup. Here's how you can pass server-side C# data from ASP.NET to HTML.
Practice makes perfect, and writing regular expressions is no exception to this. Check out Regex Tuesday for weekly challenges to improve your regex skills.
Check out the free "30 Days to Learn jQuery" course on Tuts+ if you want to take your jQuery skills to the next level.