refactor(ivy): TypeScriptReflectionHost.isClass
cannot be a type discriminator (#24897)
The `ReflectionHost` interface that is being implemented only expects a return value of `boolean`. Moreover, if you want to extend this class to support non-TS code formats, e.g. ES5, the result of this call returning true does not mean that the `node` is a `ClassDeclaration`. It could be a `VariableDeclaration`. PR Close #24897
This commit is contained in:
parent
5e98421d33
commit
185b932138
@ -127,7 +127,7 @@ export class TypeScriptReflectionHost implements ReflectionHost {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
isClass(node: ts.Declaration): node is ts.ClassDeclaration {
|
isClass(node: ts.Declaration): boolean {
|
||||||
// In TypeScript code, classes are ts.ClassDeclarations.
|
// In TypeScript code, classes are ts.ClassDeclarations.
|
||||||
return ts.isClassDeclaration(node);
|
return ts.isClassDeclaration(node);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user