feat(build): require parameter types

Fixes #2833
This commit is contained in:
Alex Eagle
2015-07-07 20:03:00 -07:00
parent 6d760666a9
commit de18da2a0d
81 changed files with 379 additions and 290 deletions

View File

@ -37,7 +37,7 @@ export class CheckboxControlValueAccessor implements ControlValueAccessor {
cd.valueAccessor = this;
}
writeValue(value) { setProperty(this.renderer, this.elementRef, "checked", value); }
writeValue(value: any) { setProperty(this.renderer, this.elementRef, "checked", value); }
get ngClassUntouched(): boolean {
return isPresent(this.cd.control) ? this.cd.control.untouched : false;
@ -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; }
registerOnTouched(fn): void { this.onTouched = fn; }
registerOnChange(fn: (_) => {}): void { this.onChange = fn; }
registerOnTouched(fn: () => {}): void { this.onTouched = fn; }
}

View File

@ -38,7 +38,7 @@ export class DefaultValueAccessor implements ControlValueAccessor {
cd.valueAccessor = this;
}
writeValue(value) {
writeValue(value: any) {
// both this.value and setProperty are required at the moment
// remove when a proper imperative API is provided
var normalizedValue = isBlank(value) ? '' : value;
@ -60,7 +60,7 @@ export class DefaultValueAccessor implements ControlValueAccessor {
return isPresent(this.cd.control) ? !this.cd.control.valid : false;
}
registerOnChange(fn): void { this.onChange = fn; }
registerOnChange(fn: (_) => void): void { this.onChange = fn; }
registerOnTouched(fn): void { this.onTouched = fn; }
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
}

View File

@ -79,7 +79,7 @@ export class NgFormControl extends NgControl {
this.ngValidators = ngValidators;
}
onChange(c) {
onChange(c: StringMap<string, any>) {
if (!this._added) {
setUpControl(this.form, this);
this.form.updateValidity();

View File

@ -49,7 +49,7 @@ export class NgModel extends NgControl {
this.ngValidators = ngValidators;
}
onChange(c) {
onChange(c: StringMap<string, any>) {
if (!this._added) {
setUpControl(this._control, this);
this._control.updateValidity();

View File

@ -49,7 +49,7 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
this._updateValueWhenListOfOptionsChanges(query);
}
writeValue(value) {
writeValue(value: any) {
this.value = value;
setProperty(this.renderer, this.elementRef, "value", value);
}
@ -69,8 +69,8 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
return isPresent(this.cd.control) ? !this.cd.control.valid : false;
}
registerOnChange(fn): void { this.onChange = fn; }
registerOnTouched(fn): void { this.onTouched = fn; }
registerOnChange(fn: () => any): void { this.onChange = fn; }
registerOnTouched(fn: () => any): void { this.onTouched = fn; }
private _updateValueWhenListOfOptionsChanges(query: QueryList<NgSelectOption>) {
query.onChange(() => this.writeValue(this.value));

View File

@ -22,7 +22,7 @@ function _find(c: AbstractControl, path: List<string | number>| string) {
if (!(path instanceof List)) {
path = StringWrapper.split(<string>path, new RegExp("/"));
}
if (ListWrapper.isEmpty(path)) return null;
if (path instanceof List && ListWrapper.isEmpty(path)) return null;
return ListWrapper.reduce(<List<string | number>>path, (v, name) => {
if (v instanceof ControlGroup) {
@ -85,7 +85,7 @@ export class AbstractControl {
}
}
setParent(parent) { this._parent = parent; }
setParent(parent: ControlGroup | ControlArray) { this._parent = parent; }
updateValidity({onlySelf}: {onlySelf?: boolean} = {}): void {
onlySelf = isPresent(onlySelf) ? onlySelf : false;