fix(compiler): allow expressions or functions in extends (#14158)
Fixes #14154 PR Close #14158
This commit is contained in:
@ -86,7 +86,7 @@ export class StaticReflector implements ReflectorReader {
|
||||
annotations = [];
|
||||
const classMetadata = this.getTypeMetadata(type);
|
||||
if (classMetadata['extends']) {
|
||||
const parentType = this.simplify(type, classMetadata['extends']);
|
||||
const parentType = this.trySimplify(type, classMetadata['extends']);
|
||||
if (parentType && (parentType instanceof StaticSymbol)) {
|
||||
const parentAnnotations = this.annotations(parentType);
|
||||
annotations.push(...parentAnnotations);
|
||||
@ -303,6 +303,17 @@ export class StaticReflector implements ReflectorReader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplify but discard any errors
|
||||
*/
|
||||
private trySimplify(context: StaticSymbol, value: any): any {
|
||||
const originalRecorder = this.errorRecorder;
|
||||
this.errorRecorder = (error: any, fileName: string) => {};
|
||||
const result = this.simplify(context, value);
|
||||
this.errorRecorder = originalRecorder;
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public simplify(context: StaticSymbol, value: any): any {
|
||||
const self = this;
|
||||
|
Reference in New Issue
Block a user