From 185b932138dde382b29da10812a6fd5742004211 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 16 Jul 2018 07:16:34 +0100 Subject: [PATCH] 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 --- packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts b/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts index 5e93aa402d..5d604f8ec0 100644 --- a/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts +++ b/packages/compiler-cli/src/ngtsc/metadata/src/reflector.ts @@ -127,7 +127,7 @@ export class TypeScriptReflectionHost implements ReflectionHost { return map; } - isClass(node: ts.Declaration): node is ts.ClassDeclaration { + isClass(node: ts.Declaration): boolean { // In TypeScript code, classes are ts.ClassDeclarations. return ts.isClassDeclaration(node); }