Add Angular to the gulp build Finally, we need to make sure that the Angular files are copied as part of the build. We need to add:
Typing the function Let’s add types to our simple examples from earlier: function
Needless Namespacing If you’re converting a program from namespaces to modules, it can be easy to end up with a file that looks like this:
Attribute type checking The first step to type checking attributes is to determine the element attributes type. This is slightly different
Update tsconfig.json Now that Angular 2 and its dependencies are installed, we need to enable TypeScript’s experimental support for decorators
Symbol.iterator A method that returns the default iterator for an object. Called by the semantics of the for-of statement.
Default exports Each module can optionally export a default export. Default exports are marked with the keyword default;
Add TypeScript code Right click on src and click New Item. Then choose TypeScript File and name
Variable capturing quirks Take a quick second to guess what the output of the following snippet is:
Setting up your Directories If you’re writing in plain JavaScript, it’s likely that you’re running your JavaScript directly, where your
Page 4 of 29