Revert "fix(forms): Update types for TypeScript nullability support"

This reverts commit 6649743a2d.

Broke in G3.
This commit is contained in:
Tobias Bosch
2017-04-17 09:47:43 -07:00
parent 2ddf3bcdd1
commit 6d930d2fc5
27 changed files with 330 additions and 343 deletions

View File

@ -18,49 +18,45 @@ import {ValidationErrors} from './validators';
* @stable
*/
export abstract class AbstractControlDirective {
abstract get control(): AbstractControl|null;
get control(): AbstractControl { throw new Error('unimplemented'); }
get value(): any { return this.control ? this.control.value : null; }
get valid(): boolean|null { return this.control ? this.control.valid : null; }
get valid(): boolean { return this.control ? this.control.valid : null; }
get invalid(): boolean|null { return this.control ? this.control.invalid : null; }
get invalid(): boolean { return this.control ? this.control.invalid : null; }
get pending(): boolean|null { return this.control ? this.control.pending : null; }
get pending(): boolean { return this.control ? this.control.pending : null; }
get errors(): ValidationErrors|null { return this.control ? this.control.errors : null; }
get pristine(): boolean|null { return this.control ? this.control.pristine : null; }
get pristine(): boolean { return this.control ? this.control.pristine : null; }
get dirty(): boolean|null { return this.control ? this.control.dirty : null; }
get dirty(): boolean { return this.control ? this.control.dirty : null; }
get touched(): boolean|null { return this.control ? this.control.touched : null; }
get touched(): boolean { return this.control ? this.control.touched : null; }
get untouched(): boolean|null { return this.control ? this.control.untouched : null; }
get untouched(): boolean { return this.control ? this.control.untouched : null; }
get disabled(): boolean|null { return this.control ? this.control.disabled : null; }
get disabled(): boolean { return this.control ? this.control.disabled : null; }
get enabled(): boolean|null { return this.control ? this.control.enabled : null; }
get enabled(): boolean { return this.control ? this.control.enabled : null; }
get statusChanges(): Observable<any>|null {
return this.control ? this.control.statusChanges : null;
}
get statusChanges(): Observable<any> { return this.control ? this.control.statusChanges : null; }
get valueChanges(): Observable<any>|null {
return this.control ? this.control.valueChanges : null;
}
get valueChanges(): Observable<any> { return this.control ? this.control.valueChanges : null; }
get path(): string[]|null { return null; }
get path(): string[] { return null; }
reset(value: any = undefined): void {
if (this.control) this.control.reset(value);
}
hasError(errorCode: string, path?: string[]): boolean {
hasError(errorCode: string, path: string[] = null): boolean {
return this.control ? this.control.hasError(errorCode, path) : false;
}
getError(errorCode: string, path?: string[]): any {
getError(errorCode: string, path: string[] = null): any {
return this.control ? this.control.getError(errorCode, path) : null;
}
}