diff --git a/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html index fe2051c2e9..9747b0983a 100644 --- a/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html +++ b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html @@ -14,7 +14,7 @@ declare module ng { type SetterFn = typeof Function; type int = number; interface Type extends Function { - new (...args); + new (...args: any[]): Type; } // See https://github.com/Microsoft/TypeScript/issues/1168 diff --git a/docs/typescript-package/services/tsParser/getExportDocType.js b/docs/typescript-package/services/tsParser/getExportDocType.js index 72aae26df2..8ee6aae684 100644 --- a/docs/typescript-package/services/tsParser/getExportDocType.js +++ b/docs/typescript-package/services/tsParser/getExportDocType.js @@ -38,19 +38,17 @@ module.exports = function getExportDocType(log) { file: ts.getSourceFileOfNode(symbol.declarations[0]).fileName }); return 'unknown'; - } + }; function getBlockScopedVariableDocType(symbol) { var node = symbol.valueDeclaration; while(node) { if ( node.flags & 0x2000 /* const */) { - // DefinitelyTyped is still TS 1.4 so const is not allowed. - // https://github.com/borisyankov/DefinitelyTyped/issues/4564 - return 'var'; // change to const when targetting TS 1.5 + return 'const'; } node = node.parent; } return 'let'; } -}; \ No newline at end of file +}; diff --git a/gulpfile.js b/gulpfile.js index 0ecb37b727..e4dd320338 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -712,6 +712,7 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() { gulp.task('test.typings', ['!pre.test.typings'], function() { return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/angular2.d.ts']) .pipe(tsc({target: 'ES5', module: 'commonjs', + noImplicitAny: true, // Don't use the version of typescript that gulp-typescript depends on, we need 1.5 // see https://github.com/ivogabe/gulp-typescript#typescript-version typescript: require('typescript')})); diff --git a/modules/angular2/src/change_detection/constants.ts b/modules/angular2/src/change_detection/constants.ts index 7ecea3295b..198905647b 100644 --- a/modules/angular2/src/change_detection/constants.ts +++ b/modules/angular2/src/change_detection/constants.ts @@ -4,32 +4,32 @@ * CHECK_ONCE means that after calling detectChanges the mode of the change detector * will become CHECKED. */ -export const CHECK_ONCE = "CHECK_ONCE"; +export const CHECK_ONCE: string = "CHECK_ONCE"; /** * CHECKED means that the change detector should be skipped until its mode changes to * CHECK_ONCE or CHECK_ALWAYS. */ -export const CHECKED = "CHECKED"; +export const CHECKED: string = "CHECKED"; /** * CHECK_ALWAYS means that after calling detectChanges the mode of the change detector * will remain CHECK_ALWAYS. */ -export const CHECK_ALWAYS = "ALWAYS_CHECK"; +export const CHECK_ALWAYS: string = "ALWAYS_CHECK"; /** * DETACHED means that the change detector sub tree is not a part of the main tree and * should be skipped. */ -export const DETACHED = "DETACHED"; +export const DETACHED: string = "DETACHED"; /** * ON_PUSH means that the change detector's mode will be set to CHECK_ONCE during hydration. */ -export const ON_PUSH = "ON_PUSH"; +export const ON_PUSH: string = "ON_PUSH"; /** * DEFAULT means that the change detector's mode will be set to CHECK_ALWAYS during hydration. */ -export const DEFAULT = "DEFAULT"; \ No newline at end of file +export const DEFAULT: string = "DEFAULT"; diff --git a/modules/angular2/src/core/application_common.ts b/modules/angular2/src/core/application_common.ts index edbc52bee8..93982edec4 100644 --- a/modules/angular2/src/core/application_common.ts +++ b/modules/angular2/src/core/application_common.ts @@ -278,8 +278,8 @@ export function createNgZone(handler: ExceptionHandler): NgZone { * Returns a `Promise` of {@link ApplicationRef}. */ export function commonBootstrap( - appComponentType: Type, componentInjectableBindings: List> = null): - Promise { + appComponentType: /*Type*/ any, + componentInjectableBindings: List> = null): Promise { BrowserDomAdapter.makeCurrent(); var bootstrapProcess = PromiseWrapper.completer(); diff --git a/modules/angular2/src/core/application_tokens.ts b/modules/angular2/src/core/application_tokens.ts index c77863c8c2..6c2e5fc72b 100644 --- a/modules/angular2/src/core/application_tokens.ts +++ b/modules/angular2/src/core/application_tokens.ts @@ -22,4 +22,4 @@ export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise implements IQueryList { get first(): T { return ListWrapper.first(this._results); } get last(): T { return ListWrapper.last(this._results); } - map(fn: (T) => U): U[] { return this._results.map(fn); } + map(fn: (item: T) => U): U[] { return this._results.map(fn); } [Symbol.iterator](): any { return this._results[Symbol.iterator](); } } diff --git a/modules/angular2/src/di/injector.ts b/modules/angular2/src/di/injector.ts index 8fb0118f44..54d53a6c39 100644 --- a/modules/angular2/src/di/injector.ts +++ b/modules/angular2/src/di/injector.ts @@ -21,11 +21,11 @@ const _notFound = CONST_EXPR(new Object()); // Threshold for the dynamic version const _MAX_CONSTRUCTION_COUNTER = 10; -export const undefinedValue = CONST_EXPR(new Object()); +export const undefinedValue: Object = CONST_EXPR(new Object()); -export const PUBLIC = 1; -export const PRIVATE = 2; -export const PUBLIC_AND_PRIVATE = 3; +export const PUBLIC: number = 1; +export const PRIVATE: number = 2; +export const PUBLIC_AND_PRIVATE: number = 3; export interface ProtoInjectorStrategy { getBindingAtIndex(index: number): ResolvedBinding; diff --git a/modules/angular2/src/di/metadata.ts b/modules/angular2/src/di/metadata.ts index ee3bfffc38..903250c809 100644 --- a/modules/angular2/src/di/metadata.ts +++ b/modules/angular2/src/di/metadata.ts @@ -196,4 +196,5 @@ export class UnboundedMetadata extends VisibilityMetadata { toString(): string { return `@Unbounded(self: ${this.includeSelf}})`; } } -export const DEFAULT_VISIBILITY = CONST_EXPR(new UnboundedMetadata({self: true})); \ No newline at end of file +export const DEFAULT_VISIBILITY: VisibilityMetadata = + CONST_EXPR(new UnboundedMetadata({self: true})); diff --git a/modules/angular2/src/forms/directives/checkbox_value_accessor.ts b/modules/angular2/src/forms/directives/checkbox_value_accessor.ts index 2ee2bb2ecc..0cdec2544e 100644 --- a/modules/angular2/src/forms/directives/checkbox_value_accessor.ts +++ b/modules/angular2/src/forms/directives/checkbox_value_accessor.ts @@ -54,6 +54,6 @@ export class CheckboxControlValueAccessor implements ControlValueAccessor { return isPresent(this.cd.control) ? !this.cd.control.valid : false; } - registerOnChange(fn: (_) => {}): void { this.onChange = fn; } + registerOnChange(fn: (_: any) => {}): void { this.onChange = fn; } registerOnTouched(fn: () => {}): void { this.onTouched = fn; } } diff --git a/modules/angular2/src/forms/directives/default_value_accessor.ts b/modules/angular2/src/forms/directives/default_value_accessor.ts index 3a4a16ca0d..8e753c42db 100644 --- a/modules/angular2/src/forms/directives/default_value_accessor.ts +++ b/modules/angular2/src/forms/directives/default_value_accessor.ts @@ -60,7 +60,7 @@ export class DefaultValueAccessor implements ControlValueAccessor { return isPresent(this.cd.control) ? !this.cd.control.valid : false; } - registerOnChange(fn: (_) => void): void { this.onChange = fn; } + registerOnChange(fn: (_: any) => void): void { this.onChange = fn; } registerOnTouched(fn: () => void): void { this.onTouched = fn; } } diff --git a/modules/angular2/src/render/dom/dom_renderer.ts b/modules/angular2/src/render/dom/dom_renderer.ts index d0dc5ec4b5..3b2dbb2896 100644 --- a/modules/angular2/src/render/dom/dom_renderer.ts +++ b/modules/angular2/src/render/dom/dom_renderer.ts @@ -31,10 +31,10 @@ import { RenderViewWithFragments } from '../api'; -export const DOCUMENT_TOKEN = CONST_EXPR(new OpaqueToken('DocumentToken')); -export const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES = +export const DOCUMENT_TOKEN: OpaqueToken = CONST_EXPR(new OpaqueToken('DocumentToken')); +export const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES: OpaqueToken = CONST_EXPR(new OpaqueToken('DomReflectPropertiesAsAttributes')); -const REFLECT_PREFIX = 'ng-reflect-'; +const REFLECT_PREFIX: string = 'ng-reflect-'; @Injectable() export class DomRenderer extends Renderer {