fix(ivy): ExpressionChangedAfterItHasBeenCheckedError for SafeValue (#33749)

Fix #33448

PR Close #33749
This commit is contained in:
Miško Hevery
2019-11-11 15:43:09 -08:00
committed by Alex Rickabaugh
parent cbb1d9f2bb
commit f2828a08bd
4 changed files with 36 additions and 6 deletions

View File

@ -87,9 +87,11 @@ class SafeResourceUrlImpl extends SafeValueImpl implements SafeResourceUrl {
getTypeName() { return BypassType.ResourceUrl; }
}
export function unwrapSafeValue(value: string | SafeValue): string {
return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity :
value as string;
export function unwrapSafeValue(value: SafeValue): string;
export function unwrapSafeValue<T>(value: T): T;
export function unwrapSafeValue<T>(value: T | SafeValue): T {
return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity as any as T :
value as any as T;
}