-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: misc updates according to PR comments
- Loading branch information
1 parent
10b0ce9
commit ec0b381
Showing
5 changed files
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { AbstractControl, FormControl, FormGroup } from '@angular/forms'; | ||
|
||
@Pipe({ name: 'asFormGroup' }) | ||
export class AsFormGroupPipe implements PipeTransform { | ||
transform(value: AbstractControl): FormGroup { | ||
return value as FormGroup; | ||
abstract class TypeEnforcerPipe<AsType, OriginalType = any> implements PipeTransform { | ||
transform(value: OriginalType): AsType { | ||
return (<any>value) as AsType; | ||
} | ||
} | ||
|
||
@Pipe({ name: 'asFormGroup' }) | ||
export class AsFormGroupPipe extends TypeEnforcerPipe<FormGroup, AbstractControl> implements PipeTransform {} | ||
|
||
@Pipe({ name: 'asFormControl' }) | ||
export class AsFormControlPipe implements PipeTransform { | ||
transform(value: AbstractControl): FormControl { | ||
return value as FormControl; | ||
} | ||
} | ||
export class AsFormControlPipe extends TypeEnforcerPipe<FormControl, AbstractControl> implements PipeTransform {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters