blob: 1bb24e81e1478e3664bd2f77944e9bef526c1c1e [file] [log] [blame]
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'cast'})
export class CastPipe implements PipeTransform {
/**
* Cast (S: SuperType) into (T: Type) using @Generics.
* @param value (S: SuperType) obtained from input type.
* @optional @param type (T CastingType)
* type?: { new (): T }
* type?: new () => T
*/
transform<S, T extends S>(value: S, type?: new () => T): T {
return <T>value;
}
}