Merging Interfaces The simplest, and perhaps most common, type of declaration merging is interface merging. At the most basic level, the merge
// Type definitions for [~THE LIBRARY NAME~] [~OPTIONAL VERSION NUMBER~] // Project: [~THE PROJECT NAME~] // Definitions by: [~YOUR
Return Types of Callbacks Don’t use the return type any for callbacks whose value will be ignored:
Aliases Another way that you can simplify working with of namespaces is to use import q = x.y.z to create shorter names for commonly-used
Gulp If you’re using Gulp in some fashion, we have a tutorial on using Gulp
Namespaced Validators namespace Validation { export interface StringValidator { isAcceptable(s:
Generic Classes A generic class has a similar shape to a generic interface. Generic classes have a generic type parameter list in angle brackets
Destructuring Another ECMAScript 2015 feature that TypeScript has is destructuring. For a complete reference, see
Optional Parameters in Callbacks Don’t use optional parameters in callbacks unless you really mean it:
Use Optional Parameters Don’t write several overloads that differ only in trailing parameters:
Page 8 of 29