diff --git a/ets2panda/linter/src/lib/TypeScriptLinter.ts b/ets2panda/linter/src/lib/TypeScriptLinter.ts index 4caeea6c346d3da2bb85927717fbe2ebeea3288d..bbbd666b47c541e484d67d09cfb4fdf00f7e8d8c 100644 --- a/ets2panda/linter/src/lib/TypeScriptLinter.ts +++ b/ets2panda/linter/src/lib/TypeScriptLinter.ts @@ -5042,9 +5042,19 @@ export class TypeScriptLinter extends BaseTypeScriptLinter { } const type = this.tsTypeChecker.getTypeAtLocation(calleeExpr); - if (type.isClassOrInterface()) { - this.incrementCounters(calleeExpr, FaultID.ConstructorIfaceFromSdk); + if (!type.symbol) { + return; + } + const typeDeclarations = type.symbol.declarations; + if (!typeDeclarations || typeDeclarations.length === 0) { + return; } + + if (!ts.isInterfaceDeclaration(typeDeclarations[0])) { + return; + } + + this.incrementCounters(calleeExpr, FaultID.ConstructorIfaceFromSdk); } private handleNewExpression(node: ts.Node): void {