diff --git a/linter-4.2/src/Utils.ts b/linter-4.2/src/Utils.ts index 1fc3ed1abd7b6ed8c1435be18dafe5ad0036e1d9..ae0ba01af4d34f8df557af06d3591934a9c91a81 100644 --- a/linter-4.2/src/Utils.ts +++ b/linter-4.2/src/Utils.ts @@ -100,7 +100,7 @@ export class TsUtils { static LIMITED_STD_GLOBAL_VAR = ['Infinity', 'NaN']; static LIMITED_STD_OBJECT_API = [ '__proto__', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'assign', 'create', - 'defineProperties', 'defineProperty', 'entries', 'freeze', 'fromEntries', 'getOwnPropertyDescriptor', + 'defineProperties', 'defineProperty', 'entries', 'freeze', 'fromEntries', 'getOwnPropertyDescriptor', 'getOwnPropertyDescriptors', 'getOwnPropertyNames', 'getOwnPropertySymbols', 'getPrototypeOf', 'hasOwn', 'hasOwnProperty', 'is', 'isExtensible', 'isFrozen', 'isPrototypeOf', 'isSealed', 'keys', 'preventExtensions', 'propertyIsEnumerable', 'seal', 'setPrototypeOf', 'values' @@ -110,7 +110,7 @@ export class TsUtils { 'has', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf' ]; static LIMITED_STD_PROXYHANDLER_API = [ - 'apply', 'construct', 'defineProperty', 'deleteProperty', 'get', 'getOwnPropertyDescriptor', 'getPrototypeOf', + 'apply', 'construct', 'defineProperty', 'deleteProperty', 'get', 'getOwnPropertyDescriptor', 'getPrototypeOf', 'has', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf' ]; static LIMITED_STD_ARRAY_API = ['isArray']; @@ -871,7 +871,7 @@ export class TsUtils { if (this.areCompatibleFunctionals(lhsType, rhsType)) { return true; } - + return lhsType === rhsType || this.hasBaseType(rhsType, this.getTargetType(lhsType)); } @@ -1229,13 +1229,19 @@ export class TsUtils { // foo({ ... }) if (ts.isCallExpression(curNode)) { const callExpr = curNode as ts.CallExpression; - let sym: ts.Symbol | undefined = this.tsTypeChecker.getTypeAtLocation(callExpr.expression).symbol; + const type = this.tsTypeChecker.getTypeAtLocation(callExpr.expression); + + // this check is a hack to fix #13474, only for tac 4.2 + if (this.isAnyType( type )) + return true; + + let sym: ts.Symbol | undefined = type.symbol; if(this.isLibrarySymbol(sym)) { return true; } // #13483: - // x.foo({ ... }), where 'x' is exported from some library: + // x.foo({ ... }), where 'x' is a variable exported from some library: if (ts.isPropertyAccessExpression(callExpr.expression)) { sym = this.tsTypeChecker.getSymbolAtLocation(callExpr.expression.expression); if (sym && sym.getFlags() & ts.SymbolFlags.Alias) {