fix(typings): test our .d.ts with --noImplicitAny
This matches how DefinitelyTyped tests it, so we are one step closer to publishing the same file we generate. See #3195
This commit is contained in:
parent
345fa521dd
commit
19d8b221b4
|
@ -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
|
||||
|
|
|
@ -38,16 +38,14 @@ 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;
|
||||
}
|
||||
|
|
|
@ -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')}));
|
||||
|
|
|
@ -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";
|
||||
export const DEFAULT: string = "DEFAULT";
|
||||
|
|
|
@ -278,8 +278,8 @@ export function createNgZone(handler: ExceptionHandler): NgZone {
|
|||
* Returns a `Promise` of {@link ApplicationRef}.
|
||||
*/
|
||||
export function commonBootstrap(
|
||||
appComponentType: Type, componentInjectableBindings: List<Type | Binding | List<any>> = null):
|
||||
Promise<ApplicationRef> {
|
||||
appComponentType: /*Type*/ any,
|
||||
componentInjectableBindings: List<Type | Binding | List<any>> = null): Promise<ApplicationRef> {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
var bootstrapProcess = PromiseWrapper.completer();
|
||||
|
||||
|
|
|
@ -22,4 +22,4 @@ export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise<C
|
|||
*
|
||||
* ```
|
||||
*/
|
||||
export const appComponentTypeToken = CONST_EXPR(new OpaqueToken('RootComponent'));
|
||||
export const appComponentTypeToken: OpaqueToken = CONST_EXPR(new OpaqueToken('RootComponent'));
|
||||
|
|
|
@ -38,7 +38,7 @@ export class QueryList<T> implements IQueryList<T> {
|
|||
get first(): T { return ListWrapper.first(this._results); }
|
||||
get last(): T { return ListWrapper.last(this._results); }
|
||||
|
||||
map<U>(fn: (T) => U): U[] { return this._results.map(fn); }
|
||||
map<U>(fn: (item: T) => U): U[] { return this._results.map(fn); }
|
||||
|
||||
[Symbol.iterator](): any { return this._results[Symbol.iterator](); }
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}));
|
||||
export const DEFAULT_VISIBILITY: VisibilityMetadata =
|
||||
CONST_EXPR(new UnboundedMetadata({self: true}));
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue