// Type definitions for Angular v2.0.0-alpha.30 // Project: http://angular.io/ // Definitions by: angular team // Definitions: https://github.com/borisyankov/DefinitelyTyped // *********************************************************** // This file is generated by the Angular build process. // Please do not create manual edits or send pull requests // modifying this file. // *********************************************************** // Angular depends transitively on these libraries. // If you don't have them installed you can run // $ tsd query es6-promise rx rx-lite --action install --save /// /// interface List extends Array {} interface Map {} interface StringMap extends Map {} declare module ng { type SetterFn = typeof Function; type int = number; interface Type extends Function { // new (...args); } // See https://github.com/Microsoft/TypeScript/issues/1168 class BaseException /* extends Error */ { message: string; stack: string; toString(): string; } } declare module ng { /** * `DependencyAnnotation` is used by the framework to extend DI. * * Only annotations implementing `DependencyAnnotation` are added to the list of dependency * properties. * * For example: * * ``` * class Parent extends DependencyAnnotation {} * class NotDependencyProperty {} * * class AComponent { * constructor(@Parent @NotDependencyProperty aService:AService) {} * } * ``` * * will create the following dependency: * * ``` * new Dependency(Key.get(AService), [new Parent()]) * ``` * * The framework can use `new Parent()` to handle the `aService` dependency * in a specific way. * * @exportedAs angular2/di_annotations */ class DependencyAnnotation { token: void; } /** * Lifecycle events are guaranteed to be called in the following order: * - `onChange` (optional if any bindings have changed), * - `onInit` (optional after the first check only), * - `onCheck`, * - `onAllChangesDone` */ class LifecycleEvent { name: string; } /** * An interface that NgFormModel and NgForm implement. * * Only used by the forms module. */ interface Form { addControl(dir: NgControl): void; removeControl(dir: NgControl): void; getControl(dir: NgControl): Control; addControlGroup(dir: NgControlGroup): void; removeControlGroup(dir: NgControlGroup): void; updateModel(dir: NgControl, value: any): void; } /** * An interface implemented by all Angular type decorators, which allows them to be used as ES7 * decorators as well as * Angular DSL syntax. * * DSL syntax: * * ``` * var MyClass = ng * .Component({...}) * .View({...}) * .Class({...}); * ``` * * ES7 syntax: * * ``` * @ng.Component({...}) * @ng.View({...}) * class MyClass {...} * ``` */ interface TypeDecorator { /** * Invoke as ES7 decorator. */ (type: T): T; /** * Storage for the accumulated annotations so far used by the DSL syntax. * * Used by Class to annotate the generated class. */ annotations: Array; /** * Generate a class from the definition and annotate it with TypeDecorator. */ Class(obj: ClassDefinition): Type; } /** * Declares the interface to be used with Class. */ interface ClassDefinition { /** * Optional argument for specifying the superclass. */ extends?: Type; /** * Required constructor function for a class. * * The function may be optionall wrapped in an `Array`, in which case additional parameter * annotations may be * specified. The number of arguments and the number of paramater annotations must match. * * See Class for example of usage. */ constructor: (Function | Array); } /** * Specifies that a QueryList should be injected. * * See QueryList for usage and example. * * @exportedAs angular2/annotations */ class Query extends DependencyAnnotation { descendants: boolean; selector: void; isVarBindingQuery: boolean; varBindings: List; toString(): string; } /** * A directive that contains a group of [NgControl]. * * Only used by the forms module. */ class ControlContainer { name: string; formDirective: Form; path: List; } /** * A marker annotation that marks a class as available to `Injector` for creation. Used by tooling * for generating constructor stubs. * * ``` * class NeedsService { * constructor(svc:UsefulService) {} * } * * @Injectable * class UsefulService {} * ``` * @exportedAs angular2/di_annotations */ class Injectable { visibility: Visibility; } /** * Specifies how injector should resolve a dependency. * * See Self, Parent, Ancestor, Unbounded. * * @exportedAs angular2/di_annotations */ class Visibility { depth: number; crossBoundaries: boolean; includeSelf: boolean; toString(): string; } /** * Injectable Objects that contains a live list of child directives in the light Dom of a directive. * The directives are kept in depth-first pre-order traversal of the DOM. * * In the future this class will implement an Observable interface. * For now it uses a plain list of observable callbacks. * * @exportedAs angular2/view */ class BaseQueryList { reset(newList: any): void; add(obj: any): void; fireCallbacks(): void; onChange(callback: any): void; removeCallback(callback: any): void; length: void; first: void; last: void; } class AppProtoView { elementBinders: List; protoLocals: Map; render: RenderProtoViewRef; protoChangeDetector: ProtoChangeDetector; variableBindings: Map; variableLocations: Map; bindElement(parent: ElementBinder, distanceToParent: int, protoElementInjector: ProtoElementInjector, componentDirective?: DirectiveBinding): ElementBinder; /** * Adds an event binding for the last created ElementBinder via bindElement. * * If the directive index is a positive integer, the event is evaluated in the context of * the given directive. * * If the directive index is -1, the event is evaluated in the context of the enclosing view. * * @param {string} eventName * @param {AST} expression * @param {int} directiveIndex The directive index in the binder or -1 when the event is not bound * to a directive */ bindEvent(eventBindings: List, boundElementIndex: number, directiveIndex?: int): void; } /** * Cost of making objects: http://jsperf.com/instantiate-size-of-object */ class AppView implements ChangeDispatcher, EventDispatcher { render: RenderViewRef; rootElementInjectors: List; elementInjectors: List; changeDetector: ChangeDetector; componentChildViews: List; viewContainers: List; preBuiltObjects: List; elementRefs: List; ref: ViewRef; /** * The context against which data-binding expressions in this view are evaluated against. * This is always a component instance. */ context: any; /** * Variables, local to this view, that can be used in binding expressions (in addition to the * context). This is used for thing like `