@ -52,5 +52,12 @@ function getHookName(hook: LifecycleHooks): string {
|
||||
return 'ngAfterViewInit';
|
||||
case LifecycleHooks.AfterViewChecked:
|
||||
return 'ngAfterViewChecked';
|
||||
default:
|
||||
// This default case is not needed by TypeScript compiler, as the switch is exhaustive.
|
||||
// However Closure Compiler does not understand that and reports an error in typed mode.
|
||||
// The `throw new Error` below works around the problem, and the unexpected: never variable
|
||||
// makes sure tsc still checks this code is unreachable.
|
||||
const unexpected: never = hook;
|
||||
throw new Error(`unexpected ${unexpected}`);
|
||||
}
|
||||
}
|
||||
|
@ -115,16 +115,13 @@ export class CompileMetadataResolver {
|
||||
return this.getGeneratedClass(dirType, cpl.hostViewClassName(dirType));
|
||||
}
|
||||
|
||||
getHostComponentType(dirType: any): StaticSymbol|Type {
|
||||
getHostComponentType(dirType: any): StaticSymbol|cpl.ProxyClass {
|
||||
const name = `${cpl.identifierName({reference: dirType})}_Host`;
|
||||
if (dirType instanceof StaticSymbol) {
|
||||
return this._staticSymbolCache.get(dirType.filePath, name);
|
||||
} else {
|
||||
const HostClass = <any>function HostClass() {};
|
||||
HostClass.overriddenName = name;
|
||||
|
||||
return HostClass;
|
||||
}
|
||||
|
||||
return this._createProxyClass(dirType, name);
|
||||
}
|
||||
|
||||
private getRendererType(dirType: any): StaticSymbol|object {
|
||||
|
@ -940,7 +940,8 @@ function needsAdditionalRootNode(astNodes: TemplateAst[]): boolean {
|
||||
|
||||
|
||||
function elementBindingDef(inputAst: BoundElementPropertyAst, dirAst: DirectiveAst): o.Expression {
|
||||
switch (inputAst.type) {
|
||||
const inputType = inputAst.type;
|
||||
switch (inputType) {
|
||||
case PropertyBindingType.Attribute:
|
||||
return o.literalArr([
|
||||
o.literal(BindingFlags.TypeElementAttribute), o.literal(inputAst.name),
|
||||
@ -965,6 +966,13 @@ function elementBindingDef(inputAst: BoundElementPropertyAst, dirAst: DirectiveA
|
||||
return o.literalArr([
|
||||
o.literal(BindingFlags.TypeElementStyle), o.literal(inputAst.name), o.literal(inputAst.unit)
|
||||
]);
|
||||
default:
|
||||
// This default case is not needed by TypeScript compiler, as the switch is exhaustive.
|
||||
// However Closure Compiler does not understand that and reports an error in typed mode.
|
||||
// The `throw new Error` below works around the problem, and the unexpected: never variable
|
||||
// makes sure tsc still checks this code is unreachable.
|
||||
const unexpected: never = inputType;
|
||||
throw new Error(`unexpected ${unexpected}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user