Union Types Union types are closely related to intersection types, but they are used very differently. Occasionally, you’ll run into a library
typeof type guards Let’s go back and write the code for the version of padLeft that uses union types. We could write
Test Run the project. You should see a message when you type in the input boxes:
/// <reference>-ing a module A common mistake is to try to use the /// <reference ... /> syntax to refer
Grunt
Symbol.search A regular expression method that returns the index within a string that matches the regular expression. Called by
Polymorphic this types A polymorphic this type represents a type that is the subtype of the containing class
Decorator Composition Multiple decorators can be applied to a declaration, as in the following examples:
Deep Dive For seasoned authors interested in the underlying mechanics of how declaration files work, the
Dependencies on Global Libraries If your library depends on a global library, use a /// <reference types="..." /> directive:
Page 16 of 29