diff --git a/lib/tsserver.js b/lib/tsserver.js index 7c26db87da046095c3af459a304e34f2b5da44f4..0c5aa30accd8d841c9be968f47cd1ec0037004db 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -171833,6 +171833,7 @@ __export(ts_ArkTSLinter_1_1_exports, { relatedByInheritanceOrIdentical: () => relatedByInheritanceOrIdentical2, runArkTSLinter: () => runArkTSLinter2, searchFileExportDecl: () => searchFileExportDecl, + setMixCompile: () => setMixCompile, setTestMode: () => setTestMode2, setTypeChecker: () => setTypeChecker2, shouldAutofix: () => shouldAutofix2, @@ -171861,7 +171862,7 @@ var ProblemSeverity2 = /* @__PURE__ */ ((ProblemSeverity3) => { // src/linter/ArkTSLinter_1_1/CookBookMsg.ts var cookBookMsg2 = []; var cookBookTag2 = []; -for (let i = 0; i <= 182; i++) { +for (let i = 0; i <= 184; i++) { cookBookMsg2[i] = ""; } cookBookTag2[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)"; @@ -172046,6 +172047,8 @@ cookBookTag2[179] = 'Casting "Non-sendable" function to "Sendable" typeAlias is cookBookTag2[180] = 'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)'; cookBookTag2[181] = ""; cookBookTag2[182] = "Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)"; +cookBookTag2[183] = 'The function passed to taskpool must be an ordinary function decorated with "@Concurrent" (arkts-taskpool-concurrent-function-args)'; +cookBookTag2[184] = "The object literal is ambiguity, the type of 1.2 cannot exist (arkts-no-ambiguity-obj-literal)"; // src/linter/ArkTSLinter_1_1/LibraryTypeCallDiagnosticChecker.ts var TYPE_0_IS_NOT_ASSIGNABLE_TO_TYPE_1_ERROR_CODE2 = 2322; @@ -172410,7 +172413,8 @@ var FaultID2 = /* @__PURE__ */ ((FaultID3) => { FaultID3[FaultID3["SharedModuleExportsWarning"] = 108] = "SharedModuleExportsWarning"; FaultID3[FaultID3["SendableBetaCompatible"] = 109] = "SendableBetaCompatible"; FaultID3[FaultID3["SendablePropTypeWarning"] = 110] = "SendablePropTypeWarning"; - FaultID3[FaultID3["LAST_ID"] = 111] = "LAST_ID"; + FaultID3[FaultID3["ObjectLiteralAmbiguity"] = 111] = "ObjectLiteralAmbiguity"; + FaultID3[FaultID3["LAST_ID"] = 112] = "LAST_ID"; return FaultID3; })(FaultID2 || {}); var FaultAttributes = class { @@ -172532,6 +172536,7 @@ faultsAttrs2[107 /* SendableDecoratorLimited */] = new FaultAttributes(180); faultsAttrs2[108 /* SharedModuleExportsWarning */] = new FaultAttributes(163, false, 1 /* WARNING */); faultsAttrs2[109 /* SendableBetaCompatible */] = new FaultAttributes(182); faultsAttrs2[110 /* SendablePropTypeWarning */] = new FaultAttributes(154, false, 1 /* WARNING */); +faultsAttrs2[111 /* ObjectLiteralAmbiguity */] = new FaultAttributes(184); // src/linter/ArkTSLinter_1_1/Utils.ts var PROPERTY_HAS_NO_INITIALIZER_ERROR_CODE2 = 2564; @@ -172590,6 +172595,10 @@ var testMode2 = false; function setTestMode2(tsTestMode) { testMode2 = tsTestMode; } +var mixCompile = false; +function setMixCompile(isMixCompile) { + mixCompile = isMixCompile; +} function getStartPos2(nodeOrComment) { return nodeOrComment.kind === 2 /* SingleLineCommentTrivia */ || nodeOrComment.kind === 3 /* MultiLineCommentTrivia */ ? nodeOrComment.pos : nodeOrComment.getStart(); } @@ -173355,7 +173364,7 @@ function getNonNullableType2(t) { } function isStaticSourceFile(lhsType) { var _a2, _b, _c; - if (typeChecker2.isStaticSourceFile) { + if (mixCompile && typeChecker2.isStaticSourceFile) { return typeChecker2.isStaticSourceFile((_c = (_b = (_a2 = lhsType.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) == null ? void 0 : _c.getSourceFile()); } return false; @@ -174757,6 +174766,7 @@ var _TypeScriptLinter2 = class { this.tscStrictDiagnostics = tscStrictDiagnostics; this.compatibleSdkVersionStage = "beta1"; this.compatibleSdkVersion = 12; + this.mixCompile = false; this.handlersMap = new Map2([ [210 /* ObjectLiteralExpression */, { handler: this.handleObjectLiteralExpression, name: "handleObjectLiteralExpression" }], [209 /* ArrayLiteralExpression */, { handler: this.handleArrayLiteralExpression, name: "handleArrayLiteralExpression" }], @@ -174820,6 +174830,7 @@ var _TypeScriptLinter2 = class { this.staticBlocks = new Set2(); const options = tsProgram.getCompilerOptions(); this.skipArkTSStaticBlocksCheck = false; + this.mixCompile = !!options.mixCompile; if (options.skipArkTSStaticBlocksCheck) { this.skipArkTSStaticBlocksCheck = options.skipArkTSStaticBlocksCheck; } @@ -174849,7 +174860,7 @@ var _TypeScriptLinter2 = class { _TypeScriptLinter2.errorLineNumbersString = ""; _TypeScriptLinter2.warningLineNumbersString = ""; autofixInfo2.length = 0; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _TypeScriptLinter2.nodeCounters[i] = 0; _TypeScriptLinter2.lineCounters[i] = 0; } @@ -175110,6 +175121,61 @@ var _TypeScriptLinter2 = class { } else if (!isStructObjectInitializer2(objectLiteralExpr) && !isDynamicLiteralInitializer2(objectLiteralExpr) && !isObjectLiteralAssignable2(objectLiteralType, objectLiteralExpr)) { this.incrementCounters(node, 2 /* ObjectLiteralNoContextType */); } + if (this.mixCompile) { + this.handleUnionTypeObjectLiteral(objectLiteralType, objectLiteralExpr); + } + } + handleUnionTypeObjectLiteral(lhsType, rhsExpr) { + if (!_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile) { + return; + } + if (lhsType === void 0) { + return; + } + lhsType = getNonNullableType2(lhsType); + if (!lhsType.isUnion()) { + return; + } + const rhsType = _TypeScriptLinter2.tsTypeChecker.getTypeAtLocation(rhsExpr); + let assignableTypesCount = 0; + let typeInArkts2 = false; + for (const compType of lhsType.types) { + const comTypeSorceFile = this.getSourceFileFromType(compType); + if (_TypeScriptLinter2.tsTypeChecker.isTypeAssignableTo(rhsType, compType) && isObjectLiteralAssignable2(compType, rhsExpr)) { + assignableTypesCount = assignableTypesCount + 1; + if (_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile(comTypeSorceFile)) { + typeInArkts2 = true; + } + } + } + if (assignableTypesCount >= 2 && typeInArkts2) { + this.incrementCounters(rhsExpr, 111 /* ObjectLiteralAmbiguity */); + } + } + getSourceFileFromType(type) { + var _a2; + const symbol = type.getSymbol(); + if (symbol) { + const declaration = symbol.valueDeclaration || ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]); + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const constructSignatures = type.getConstructSignatures(); + if (constructSignatures.length > 0) { + const declaration = constructSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const callSignatures = type.getCallSignatures(); + if (callSignatures.length > 0) { + const declaration = callSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + return void 0; } handleArrayLiteralExpression(node) { if (isDestructuringAssignmentLHS2(node)) { @@ -176760,7 +176826,7 @@ var _InteropTypescriptLinter = class { _InteropTypescriptLinter.totalWarningLines = 0; _InteropTypescriptLinter.errorLineNumbersString = ""; _InteropTypescriptLinter.warningLineNumbersString = ""; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _InteropTypescriptLinter.nodeCounters[i] = 0; _InteropTypescriptLinter.lineCounters[i] = 0; } @@ -177250,6 +177316,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer TypeScriptLinter2.initStatic(); const linter = new TypeScriptLinter2(fileToLint, program, tscStrictDiagnostics); setTypeChecker2(TypeScriptLinter2.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); linter.lint(); currentDiagnostics = (_a2 = tscStrictDiagnostics.get(normalizePath(fileToLint.fileName))) != null ? _a2 : []; TypeScriptLinter2.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); @@ -177265,6 +177332,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer } const InteropLinter = new InteropTypescriptLinter(fileToLint, program, isInSdk); setTypeChecker2(InteropTypescriptLinter.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); InteropLinter.lint(); currentDiagnostics = []; InteropTypescriptLinter.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index fbc942520d1cf7b2998fa1eccde8c6602cc98cb8..1ff41729852bc56d1300aeeca9eb6e9066307a8c 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -7400,6 +7400,7 @@ declare namespace ts { etsAnnotationsEnable?: boolean; maxFlowDepth?: number; skipOhModulesLint?: boolean; + mixCompile?: boolean; } interface EtsOptions { render: { @@ -13066,7 +13067,8 @@ declare namespace ts { SharedModuleExportsWarning = 108, SendableBetaCompatible = 109, SendablePropTypeWarning = 110, - LAST_ID = 111 + ObjectLiteralAmbiguity = 111, + LAST_ID = 112 } class FaultAttributes { cookBookRef: number; @@ -13078,6 +13080,7 @@ declare namespace ts { function setTypeChecker(tsTypeChecker: TypeChecker): void; function clearTypeChecker(): void; function setTestMode(tsTestMode: boolean): void; + function setMixCompile(isMixCompile: boolean): void; function getStartPos(nodeOrComment: Node | CommentRange): number; function getEndPos(nodeOrComment: Node | CommentRange): number; function getHighlightRange(nodeOrComment: Node | CommentRange, faultId: number): [ @@ -13405,6 +13408,7 @@ declare namespace ts { private fileExportDeclCaches?; private compatibleSdkVersionStage; private compatibleSdkVersion; + private mixCompile; constructor(sourceFile: SourceFile, tsProgram: Program, tscStrictDiagnostics?: Map | undefined); static clearTsTypeChecker(): void; static clearQualifiedNameCache(): void; @@ -13423,6 +13427,8 @@ declare namespace ts { private interfaceInheritanceLint; private lintForInterfaceExtendsDifferentPorpertyTypes; private handleObjectLiteralExpression; + private handleUnionTypeObjectLiteral; + private getSourceFileFromType; private handleArrayLiteralExpression; private handleParameter; private handleEnumDeclaration; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 3d8a7b5f644d3b12aec64a212d01239950e7e76e..a01094b48ae423e638dad31ef5191a51b4b915ca 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -171549,6 +171549,7 @@ __export(ts_ArkTSLinter_1_1_exports, { relatedByInheritanceOrIdentical: () => relatedByInheritanceOrIdentical2, runArkTSLinter: () => runArkTSLinter2, searchFileExportDecl: () => searchFileExportDecl, + setMixCompile: () => setMixCompile, setTestMode: () => setTestMode2, setTypeChecker: () => setTypeChecker2, shouldAutofix: () => shouldAutofix2, @@ -171577,7 +171578,7 @@ var ProblemSeverity2 = /* @__PURE__ */ ((ProblemSeverity3) => { // src/linter/ArkTSLinter_1_1/CookBookMsg.ts var cookBookMsg2 = []; var cookBookTag2 = []; -for (let i = 0; i <= 182; i++) { +for (let i = 0; i <= 184; i++) { cookBookMsg2[i] = ""; } cookBookTag2[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)"; @@ -171762,6 +171763,8 @@ cookBookTag2[179] = 'Casting "Non-sendable" function to "Sendable" typeAlias is cookBookTag2[180] = 'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)'; cookBookTag2[181] = ""; cookBookTag2[182] = "Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)"; +cookBookTag2[183] = 'The function passed to taskpool must be an ordinary function decorated with "@Concurrent" (arkts-taskpool-concurrent-function-args)'; +cookBookTag2[184] = "The object literal is ambiguity, the type of 1.2 cannot exist (arkts-no-ambiguity-obj-literal)"; // src/linter/ArkTSLinter_1_1/LibraryTypeCallDiagnosticChecker.ts var TYPE_0_IS_NOT_ASSIGNABLE_TO_TYPE_1_ERROR_CODE2 = 2322; @@ -172126,7 +172129,8 @@ var FaultID2 = /* @__PURE__ */ ((FaultID3) => { FaultID3[FaultID3["SharedModuleExportsWarning"] = 108] = "SharedModuleExportsWarning"; FaultID3[FaultID3["SendableBetaCompatible"] = 109] = "SendableBetaCompatible"; FaultID3[FaultID3["SendablePropTypeWarning"] = 110] = "SendablePropTypeWarning"; - FaultID3[FaultID3["LAST_ID"] = 111] = "LAST_ID"; + FaultID3[FaultID3["ObjectLiteralAmbiguity"] = 111] = "ObjectLiteralAmbiguity"; + FaultID3[FaultID3["LAST_ID"] = 112] = "LAST_ID"; return FaultID3; })(FaultID2 || {}); var FaultAttributes = class { @@ -172248,6 +172252,7 @@ faultsAttrs2[107 /* SendableDecoratorLimited */] = new FaultAttributes(180); faultsAttrs2[108 /* SharedModuleExportsWarning */] = new FaultAttributes(163, false, 1 /* WARNING */); faultsAttrs2[109 /* SendableBetaCompatible */] = new FaultAttributes(182); faultsAttrs2[110 /* SendablePropTypeWarning */] = new FaultAttributes(154, false, 1 /* WARNING */); +faultsAttrs2[111 /* ObjectLiteralAmbiguity */] = new FaultAttributes(184); // src/linter/ArkTSLinter_1_1/Utils.ts var PROPERTY_HAS_NO_INITIALIZER_ERROR_CODE2 = 2564; @@ -172306,6 +172311,10 @@ var testMode2 = false; function setTestMode2(tsTestMode) { testMode2 = tsTestMode; } +var mixCompile = false; +function setMixCompile(isMixCompile) { + mixCompile = isMixCompile; +} function getStartPos2(nodeOrComment) { return nodeOrComment.kind === 2 /* SingleLineCommentTrivia */ || nodeOrComment.kind === 3 /* MultiLineCommentTrivia */ ? nodeOrComment.pos : nodeOrComment.getStart(); } @@ -173071,7 +173080,7 @@ function getNonNullableType2(t) { } function isStaticSourceFile(lhsType) { var _a2, _b, _c; - if (typeChecker2.isStaticSourceFile) { + if (mixCompile && typeChecker2.isStaticSourceFile) { return typeChecker2.isStaticSourceFile((_c = (_b = (_a2 = lhsType.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) == null ? void 0 : _c.getSourceFile()); } return false; @@ -174473,6 +174482,7 @@ var _TypeScriptLinter2 = class { this.tscStrictDiagnostics = tscStrictDiagnostics; this.compatibleSdkVersionStage = "beta1"; this.compatibleSdkVersion = 12; + this.mixCompile = false; this.handlersMap = new Map2([ [210 /* ObjectLiteralExpression */, { handler: this.handleObjectLiteralExpression, name: "handleObjectLiteralExpression" }], [209 /* ArrayLiteralExpression */, { handler: this.handleArrayLiteralExpression, name: "handleArrayLiteralExpression" }], @@ -174536,6 +174546,7 @@ var _TypeScriptLinter2 = class { this.staticBlocks = new Set2(); const options = tsProgram.getCompilerOptions(); this.skipArkTSStaticBlocksCheck = false; + this.mixCompile = !!options.mixCompile; if (options.skipArkTSStaticBlocksCheck) { this.skipArkTSStaticBlocksCheck = options.skipArkTSStaticBlocksCheck; } @@ -174565,7 +174576,7 @@ var _TypeScriptLinter2 = class { _TypeScriptLinter2.errorLineNumbersString = ""; _TypeScriptLinter2.warningLineNumbersString = ""; autofixInfo2.length = 0; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _TypeScriptLinter2.nodeCounters[i] = 0; _TypeScriptLinter2.lineCounters[i] = 0; } @@ -174826,6 +174837,61 @@ var _TypeScriptLinter2 = class { } else if (!isStructObjectInitializer2(objectLiteralExpr) && !isDynamicLiteralInitializer2(objectLiteralExpr) && !isObjectLiteralAssignable2(objectLiteralType, objectLiteralExpr)) { this.incrementCounters(node, 2 /* ObjectLiteralNoContextType */); } + if (this.mixCompile) { + this.handleUnionTypeObjectLiteral(objectLiteralType, objectLiteralExpr); + } + } + handleUnionTypeObjectLiteral(lhsType, rhsExpr) { + if (!_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile) { + return; + } + if (lhsType === void 0) { + return; + } + lhsType = getNonNullableType2(lhsType); + if (!lhsType.isUnion()) { + return; + } + const rhsType = _TypeScriptLinter2.tsTypeChecker.getTypeAtLocation(rhsExpr); + let assignableTypesCount = 0; + let typeInArkts2 = false; + for (const compType of lhsType.types) { + const comTypeSorceFile = this.getSourceFileFromType(compType); + if (_TypeScriptLinter2.tsTypeChecker.isTypeAssignableTo(rhsType, compType) && isObjectLiteralAssignable2(compType, rhsExpr)) { + assignableTypesCount = assignableTypesCount + 1; + if (_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile(comTypeSorceFile)) { + typeInArkts2 = true; + } + } + } + if (assignableTypesCount >= 2 && typeInArkts2) { + this.incrementCounters(rhsExpr, 111 /* ObjectLiteralAmbiguity */); + } + } + getSourceFileFromType(type) { + var _a2; + const symbol = type.getSymbol(); + if (symbol) { + const declaration = symbol.valueDeclaration || ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]); + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const constructSignatures = type.getConstructSignatures(); + if (constructSignatures.length > 0) { + const declaration = constructSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const callSignatures = type.getCallSignatures(); + if (callSignatures.length > 0) { + const declaration = callSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + return void 0; } handleArrayLiteralExpression(node) { if (isDestructuringAssignmentLHS2(node)) { @@ -176476,7 +176542,7 @@ var _InteropTypescriptLinter = class { _InteropTypescriptLinter.totalWarningLines = 0; _InteropTypescriptLinter.errorLineNumbersString = ""; _InteropTypescriptLinter.warningLineNumbersString = ""; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _InteropTypescriptLinter.nodeCounters[i] = 0; _InteropTypescriptLinter.lineCounters[i] = 0; } @@ -176966,6 +177032,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer TypeScriptLinter2.initStatic(); const linter = new TypeScriptLinter2(fileToLint, program, tscStrictDiagnostics); setTypeChecker2(TypeScriptLinter2.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); linter.lint(); currentDiagnostics = (_a2 = tscStrictDiagnostics.get(normalizePath(fileToLint.fileName))) != null ? _a2 : []; TypeScriptLinter2.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); @@ -176981,6 +177048,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer } const InteropLinter = new InteropTypescriptLinter(fileToLint, program, isInSdk); setTypeChecker2(InteropTypescriptLinter.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); InteropLinter.lint(); currentDiagnostics = []; InteropTypescriptLinter.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 0cac1ce9a6980de21dc927365fa758e005d63f2e..a47cbcd6959df26f1bd440a6108f44a210a33f02 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -3397,6 +3397,7 @@ declare namespace ts { etsAnnotationsEnable?: boolean; maxFlowDepth?: number; skipOhModulesLint?: boolean; + mixCompile?: boolean; } interface EtsOptions { render: { @@ -9136,7 +9137,8 @@ declare namespace ts { SharedModuleExportsWarning = 108, SendableBetaCompatible = 109, SendablePropTypeWarning = 110, - LAST_ID = 111 + ObjectLiteralAmbiguity = 111, + LAST_ID = 112 } class FaultAttributes { cookBookRef: number; @@ -9148,6 +9150,7 @@ declare namespace ts { function setTypeChecker(tsTypeChecker: TypeChecker): void; function clearTypeChecker(): void; function setTestMode(tsTestMode: boolean): void; + function setMixCompile(isMixCompile: boolean): void; function getStartPos(nodeOrComment: Node | CommentRange): number; function getEndPos(nodeOrComment: Node | CommentRange): number; function getHighlightRange(nodeOrComment: Node | CommentRange, faultId: number): [ @@ -9475,6 +9478,7 @@ declare namespace ts { private fileExportDeclCaches?; private compatibleSdkVersionStage; private compatibleSdkVersion; + private mixCompile; constructor(sourceFile: SourceFile, tsProgram: Program, tscStrictDiagnostics?: Map | undefined); static clearTsTypeChecker(): void; static clearQualifiedNameCache(): void; @@ -9493,6 +9497,8 @@ declare namespace ts { private interfaceInheritanceLint; private lintForInterfaceExtendsDifferentPorpertyTypes; private handleObjectLiteralExpression; + private handleUnionTypeObjectLiteral; + private getSourceFileFromType; private handleArrayLiteralExpression; private handleParameter; private handleEnumDeclaration; diff --git a/lib/typescript.js b/lib/typescript.js index baaa5fb2b5ce094c6d7a5e7b33e64f5447cb31b5..54f4f1871c4e4e3d58cd3db5aaffe0b3d8f74331 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -159841,6 +159841,7 @@ __export(ts_ArkTSLinter_1_1_exports, { relatedByInheritanceOrIdentical: () => relatedByInheritanceOrIdentical2, runArkTSLinter: () => runArkTSLinter2, searchFileExportDecl: () => searchFileExportDecl, + setMixCompile: () => setMixCompile, setTestMode: () => setTestMode2, setTypeChecker: () => setTypeChecker2, shouldAutofix: () => shouldAutofix2, @@ -159869,7 +159870,7 @@ var ProblemSeverity2 = /* @__PURE__ */ ((ProblemSeverity3) => { // src/linter/ArkTSLinter_1_1/CookBookMsg.ts var cookBookMsg2 = []; var cookBookTag2 = []; -for (let i = 0; i <= 182; i++) { +for (let i = 0; i <= 184; i++) { cookBookMsg2[i] = ""; } cookBookTag2[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)"; @@ -160054,6 +160055,8 @@ cookBookTag2[179] = 'Casting "Non-sendable" function to "Sendable" typeAlias is cookBookTag2[180] = 'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)'; cookBookTag2[181] = ""; cookBookTag2[182] = "Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)"; +cookBookTag2[183] = 'The function passed to taskpool must be an ordinary function decorated with "@Concurrent" (arkts-taskpool-concurrent-function-args)'; +cookBookTag2[184] = "The object literal is ambiguity, the type of 1.2 cannot exist (arkts-no-ambiguity-obj-literal)"; // src/linter/ArkTSLinter_1_1/LibraryTypeCallDiagnosticChecker.ts var TYPE_0_IS_NOT_ASSIGNABLE_TO_TYPE_1_ERROR_CODE2 = 2322; @@ -160418,7 +160421,8 @@ var FaultID2 = /* @__PURE__ */ ((FaultID3) => { FaultID3[FaultID3["SharedModuleExportsWarning"] = 108] = "SharedModuleExportsWarning"; FaultID3[FaultID3["SendableBetaCompatible"] = 109] = "SendableBetaCompatible"; FaultID3[FaultID3["SendablePropTypeWarning"] = 110] = "SendablePropTypeWarning"; - FaultID3[FaultID3["LAST_ID"] = 111] = "LAST_ID"; + FaultID3[FaultID3["ObjectLiteralAmbiguity"] = 111] = "ObjectLiteralAmbiguity"; + FaultID3[FaultID3["LAST_ID"] = 112] = "LAST_ID"; return FaultID3; })(FaultID2 || {}); var FaultAttributes = class { @@ -160540,6 +160544,7 @@ faultsAttrs2[107 /* SendableDecoratorLimited */] = new FaultAttributes(180); faultsAttrs2[108 /* SharedModuleExportsWarning */] = new FaultAttributes(163, false, 1 /* WARNING */); faultsAttrs2[109 /* SendableBetaCompatible */] = new FaultAttributes(182); faultsAttrs2[110 /* SendablePropTypeWarning */] = new FaultAttributes(154, false, 1 /* WARNING */); +faultsAttrs2[111 /* ObjectLiteralAmbiguity */] = new FaultAttributes(184); // src/linter/ArkTSLinter_1_1/Utils.ts var PROPERTY_HAS_NO_INITIALIZER_ERROR_CODE2 = 2564; @@ -160598,6 +160603,10 @@ var testMode2 = false; function setTestMode2(tsTestMode) { testMode2 = tsTestMode; } +var mixCompile = false; +function setMixCompile(isMixCompile) { + mixCompile = isMixCompile; +} function getStartPos2(nodeOrComment) { return nodeOrComment.kind === 2 /* SingleLineCommentTrivia */ || nodeOrComment.kind === 3 /* MultiLineCommentTrivia */ ? nodeOrComment.pos : nodeOrComment.getStart(); } @@ -161363,7 +161372,7 @@ function getNonNullableType2(t) { } function isStaticSourceFile(lhsType) { var _a2, _b, _c; - if (typeChecker2.isStaticSourceFile) { + if (mixCompile && typeChecker2.isStaticSourceFile) { return typeChecker2.isStaticSourceFile((_c = (_b = (_a2 = lhsType.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) == null ? void 0 : _c.getSourceFile()); } return false; @@ -162765,6 +162774,7 @@ var _TypeScriptLinter2 = class { this.tscStrictDiagnostics = tscStrictDiagnostics; this.compatibleSdkVersionStage = "beta1"; this.compatibleSdkVersion = 12; + this.mixCompile = false; this.handlersMap = new Map2([ [210 /* ObjectLiteralExpression */, { handler: this.handleObjectLiteralExpression, name: "handleObjectLiteralExpression" }], [209 /* ArrayLiteralExpression */, { handler: this.handleArrayLiteralExpression, name: "handleArrayLiteralExpression" }], @@ -162828,6 +162838,7 @@ var _TypeScriptLinter2 = class { this.staticBlocks = new Set2(); const options = tsProgram.getCompilerOptions(); this.skipArkTSStaticBlocksCheck = false; + this.mixCompile = !!options.mixCompile; if (options.skipArkTSStaticBlocksCheck) { this.skipArkTSStaticBlocksCheck = options.skipArkTSStaticBlocksCheck; } @@ -162857,7 +162868,7 @@ var _TypeScriptLinter2 = class { _TypeScriptLinter2.errorLineNumbersString = ""; _TypeScriptLinter2.warningLineNumbersString = ""; autofixInfo2.length = 0; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _TypeScriptLinter2.nodeCounters[i] = 0; _TypeScriptLinter2.lineCounters[i] = 0; } @@ -163118,6 +163129,61 @@ var _TypeScriptLinter2 = class { } else if (!isStructObjectInitializer2(objectLiteralExpr) && !isDynamicLiteralInitializer2(objectLiteralExpr) && !isObjectLiteralAssignable2(objectLiteralType, objectLiteralExpr)) { this.incrementCounters(node, 2 /* ObjectLiteralNoContextType */); } + if (this.mixCompile) { + this.handleUnionTypeObjectLiteral(objectLiteralType, objectLiteralExpr); + } + } + handleUnionTypeObjectLiteral(lhsType, rhsExpr) { + if (!_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile) { + return; + } + if (lhsType === void 0) { + return; + } + lhsType = getNonNullableType2(lhsType); + if (!lhsType.isUnion()) { + return; + } + const rhsType = _TypeScriptLinter2.tsTypeChecker.getTypeAtLocation(rhsExpr); + let assignableTypesCount = 0; + let typeInArkts2 = false; + for (const compType of lhsType.types) { + const comTypeSorceFile = this.getSourceFileFromType(compType); + if (_TypeScriptLinter2.tsTypeChecker.isTypeAssignableTo(rhsType, compType) && isObjectLiteralAssignable2(compType, rhsExpr)) { + assignableTypesCount = assignableTypesCount + 1; + if (_TypeScriptLinter2.tsTypeChecker.isStaticSourceFile(comTypeSorceFile)) { + typeInArkts2 = true; + } + } + } + if (assignableTypesCount >= 2 && typeInArkts2) { + this.incrementCounters(rhsExpr, 111 /* ObjectLiteralAmbiguity */); + } + } + getSourceFileFromType(type) { + var _a2; + const symbol = type.getSymbol(); + if (symbol) { + const declaration = symbol.valueDeclaration || ((_a2 = symbol.declarations) == null ? void 0 : _a2[0]); + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const constructSignatures = type.getConstructSignatures(); + if (constructSignatures.length > 0) { + const declaration = constructSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + const callSignatures = type.getCallSignatures(); + if (callSignatures.length > 0) { + const declaration = callSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + return void 0; } handleArrayLiteralExpression(node) { if (isDestructuringAssignmentLHS2(node)) { @@ -164768,7 +164834,7 @@ var _InteropTypescriptLinter = class { _InteropTypescriptLinter.totalWarningLines = 0; _InteropTypescriptLinter.errorLineNumbersString = ""; _InteropTypescriptLinter.warningLineNumbersString = ""; - for (let i = 0; i < 111 /* LAST_ID */; i++) { + for (let i = 0; i < 112 /* LAST_ID */; i++) { _InteropTypescriptLinter.nodeCounters[i] = 0; _InteropTypescriptLinter.lineCounters[i] = 0; } @@ -165258,6 +165324,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer TypeScriptLinter2.initStatic(); const linter = new TypeScriptLinter2(fileToLint, program, tscStrictDiagnostics); setTypeChecker2(TypeScriptLinter2.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); linter.lint(); currentDiagnostics = (_a2 = tscStrictDiagnostics.get(normalizePath(fileToLint.fileName))) != null ? _a2 : []; TypeScriptLinter2.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); @@ -165273,6 +165340,7 @@ function runArkTSLinter2(tsBuilderProgram, srcFile, buildInfoWriteFile, arkTSVer } const InteropLinter = new InteropTypescriptLinter(fileToLint, program, isInSdk); setTypeChecker2(InteropTypescriptLinter.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); InteropLinter.lint(); currentDiagnostics = []; InteropTypescriptLinter.problemsInfos.forEach((x) => currentDiagnostics.push(translateDiag2(fileToLint, x))); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a2d76fe2c3b935ce4fa7094da15522e55016edbe..5a3b27cce7ac4aa05f35c9d9850d6eb4802583a5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6961,6 +6961,7 @@ export interface CompilerOptions { etsAnnotationsEnable?: boolean; maxFlowDepth?: number; // The value of maxFlowDepth ranges from 2000 to 65535. skipOhModulesLint?: boolean; + mixCompile?: boolean; } export interface EtsOptions { diff --git a/src/linter/ArkTSLinter_1_1/CookBookMsg.ts b/src/linter/ArkTSLinter_1_1/CookBookMsg.ts index 01476ebfcda68071b45ed32aae5d0318673e46e7..a8b3ca26424cc884a07d1ae625086fafaad6afae 100644 --- a/src/linter/ArkTSLinter_1_1/CookBookMsg.ts +++ b/src/linter/ArkTSLinter_1_1/CookBookMsg.ts @@ -15,7 +15,7 @@ export const cookBookMsg: string[] = []; export const cookBookTag: string[] = []; -for (let i = 0; i <= 182; i++) { +for (let i = 0; i <= 184; i++) { cookBookMsg[i] = ""; } @@ -202,4 +202,6 @@ cookBookTag[180] = 'The "@Sendable" decorator can only be used on "class", "function" and "typeAlias" (arkts-sendable-decorator-limited)'; cookBookTag[181] = ''; cookBookTag[182] = -'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)'; \ No newline at end of file +'Sendable functions and sendable typealias are not available when compatibleSdkVersionStage is lowering than beta3 of API12 (arkts-sendable-beta-compatible)'; +cookBookTag[183] = 'The function passed to taskpool must be an ordinary function decorated with "@Concurrent" (arkts-taskpool-concurrent-function-args)'; +cookBookTag[184] = 'The object literal is ambiguity, the type of 1.2 cannot exist (arkts-no-ambiguity-obj-literal)'; diff --git a/src/linter/ArkTSLinter_1_1/LinterRunner.ts b/src/linter/ArkTSLinter_1_1/LinterRunner.ts index 061d3f2b5deec6831089d8d74abceef9d687d2da..d9fa3077726303c5f2e55af366b796f99e375df7 100644 --- a/src/linter/ArkTSLinter_1_1/LinterRunner.ts +++ b/src/linter/ArkTSLinter_1_1/LinterRunner.ts @@ -20,7 +20,7 @@ import { } from "../_namespaces/ts"; import { LibraryTypeCallDiagnosticChecker, TypeScriptLinter, InteropTypescriptLinter, ProblemSeverity, ProblemInfo, setTypeChecker, clearTypeChecker, - clearTrueSymbolAtLocationCache, LinterConfig, TSCCompiledProgram, clearUtilsGlobalvariables + clearTrueSymbolAtLocationCache, LinterConfig, TSCCompiledProgram, clearUtilsGlobalvariables, setMixCompile } from "../_namespaces/ts.ArkTSLinter_1_1"; function makeDiag(category: DiagnosticCategory, code: number, file: SourceFile, start: number, length: number, messageText: string): Diagnostic { @@ -108,6 +108,7 @@ buildInfoWriteFile?: WriteFileCallback, arkTSVersion?: string): Diagnostic[] { TypeScriptLinter.initStatic(); const linter = new TypeScriptLinter(fileToLint, program, tscStrictDiagnostics); setTypeChecker(TypeScriptLinter.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); linter.lint(); // Get list of bad nodes from the current run. @@ -125,6 +126,7 @@ buildInfoWriteFile?: WriteFileCallback, arkTSVersion?: string): Diagnostic[] { } const InteropLinter = new InteropTypescriptLinter(fileToLint, program, isInSdk); setTypeChecker(InteropTypescriptLinter.tsTypeChecker); + setMixCompile(!!compilerOptions.mixCompile); InteropLinter.lint(); currentDiagnostics = []; diff --git a/src/linter/ArkTSLinter_1_1/Problems.ts b/src/linter/ArkTSLinter_1_1/Problems.ts index 8f1693c09741bb478e7e7dceb6f56fec5a520f99..c47c811e515e5519c3cc8b162806aabe8dc7e2e5 100644 --- a/src/linter/ArkTSLinter_1_1/Problems.ts +++ b/src/linter/ArkTSLinter_1_1/Problems.ts @@ -42,7 +42,7 @@ export enum FaultID { SendableExplicitFieldType, SendableFunctionImportedVariables, SendableFunctionDecorator, SendableTypeAliasDecorator, SendableTypeAliasDeclaration, SendableFunctionAssignment, SendableFunctionOverloadDecorator, SendableFunctionProperty, SendableFunctionAsExpr, - SendableDecoratorLimited, SharedModuleExportsWarning, SendableBetaCompatible, SendablePropTypeWarning, + SendableDecoratorLimited, SharedModuleExportsWarning, SendableBetaCompatible, SendablePropTypeWarning, ObjectLiteralAmbiguity, LAST_ID, // this should always be last enum } @@ -166,4 +166,5 @@ faultsAttrs[FaultID.SendableFunctionAsExpr] = new FaultAttributes(179); faultsAttrs[FaultID.SendableDecoratorLimited] = new FaultAttributes(180); faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING); faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182); -faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING); \ No newline at end of file +faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING); +faultsAttrs[FaultID.ObjectLiteralAmbiguity] = new FaultAttributes(184); diff --git a/src/linter/ArkTSLinter_1_1/TypeScriptLinter.ts b/src/linter/ArkTSLinter_1_1/TypeScriptLinter.ts index 15a2661e9338a1b08c10d7b29faa52787d7b40f2..4026f09d55fc33feb69922220652ea7ec4ad8d71 100644 --- a/src/linter/ArkTSLinter_1_1/TypeScriptLinter.ts +++ b/src/linter/ArkTSLinter_1_1/TypeScriptLinter.ts @@ -175,6 +175,7 @@ export class TypeScriptLinter { private fileExportDeclCaches?: Set; private compatibleSdkVersionStage: string = 'beta1'; private compatibleSdkVersion: number = 12; + private mixCompile: boolean = false; constructor(private sourceFile: SourceFile, /* private */ tsProgram: Program, @@ -186,6 +187,7 @@ export class TypeScriptLinter { const options = tsProgram.getCompilerOptions(); this.skipArkTSStaticBlocksCheck = false; + this.mixCompile = !!options.mixCompile; if (options.skipArkTSStaticBlocksCheck) { this.skipArkTSStaticBlocksCheck = options.skipArkTSStaticBlocksCheck as boolean; } @@ -568,6 +570,69 @@ readonly handlersMap = new Map([ ) { this.incrementCounters(node, FaultID.ObjectLiteralNoContextType); } + if (this.mixCompile) { + this.handleUnionTypeObjectLiteral(objectLiteralType, objectLiteralExpr); + } + } + + private handleUnionTypeObjectLiteral(lhsType: ts.Type | undefined, rhsExpr: ts.ObjectLiteralExpression): void { + if (!TypeScriptLinter.tsTypeChecker.isStaticSourceFile) { + return; + } + + if (lhsType === undefined) { + return; + } + + lhsType = getNonNullableType(lhsType); + if (!lhsType.isUnion()) { + return; + } + + const rhsType = TypeScriptLinter.tsTypeChecker.getTypeAtLocation(rhsExpr); + let assignableTypesCount: number = 0; + let typeInArkts2: boolean = false; + for (const compType of lhsType.types) { + const comTypeSorceFile = this.getSourceFileFromType(compType); + if (TypeScriptLinter.tsTypeChecker.isTypeAssignableTo(rhsType, compType) + && isObjectLiteralAssignable(compType, rhsExpr)) { + assignableTypesCount = assignableTypesCount + 1; + if (TypeScriptLinter.tsTypeChecker.isStaticSourceFile(comTypeSorceFile)) { + typeInArkts2 = true; + } + } + } + + if (assignableTypesCount >= 2 && typeInArkts2) { + this.incrementCounters(rhsExpr, FaultID.ObjectLiteralAmbiguity); + } + } + + private getSourceFileFromType(type: ts.Type): SourceFile | undefined { + const symbol = type.getSymbol(); + if (symbol) { + const declaration = symbol.valueDeclaration || symbol.declarations?.[0]; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + + const constructSignatures = type.getConstructSignatures(); + if (constructSignatures.length > 0) { + const declaration = constructSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + + const callSignatures = type.getCallSignatures(); + if (callSignatures.length > 0) { + const declaration = callSignatures[0].declaration; + if (declaration && declaration.getSourceFile) { + return declaration.getSourceFile(); + } + } + return undefined; } private handleArrayLiteralExpression(node: Node): void { diff --git a/src/linter/ArkTSLinter_1_1/Utils.ts b/src/linter/ArkTSLinter_1_1/Utils.ts index 5a44df49d062d53e6cde3b1ef1c29d967670507b..002caf11a86564fec93a326ef4095e70a3de2ac6 100644 --- a/src/linter/ArkTSLinter_1_1/Utils.ts +++ b/src/linter/ArkTSLinter_1_1/Utils.ts @@ -107,6 +107,11 @@ export function setTestMode(tsTestMode: boolean): void { testMode = tsTestMode; } +let mixCompile = false; +export function setMixCompile(isMixCompile: boolean): void { + mixCompile = isMixCompile; +} + export function getStartPos(nodeOrComment: Node | CommentRange): number { return (nodeOrComment.kind === SyntaxKind.SingleLineCommentTrivia || nodeOrComment.kind === SyntaxKind.MultiLineCommentTrivia) ? (nodeOrComment as CommentRange).pos @@ -1186,7 +1191,7 @@ export function getNonNullableType(t: Type): Type { } function isStaticSourceFile(lhsType: Type): boolean { - if (typeChecker.isStaticSourceFile) { + if (mixCompile && typeChecker.isStaticSourceFile) { return typeChecker.isStaticSourceFile(lhsType.symbol?.declarations?.[0]?.getSourceFile()); } // keep default logic diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index fbc942520d1cf7b2998fa1eccde8c6602cc98cb8..1ff41729852bc56d1300aeeca9eb6e9066307a8c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -7400,6 +7400,7 @@ declare namespace ts { etsAnnotationsEnable?: boolean; maxFlowDepth?: number; skipOhModulesLint?: boolean; + mixCompile?: boolean; } interface EtsOptions { render: { @@ -13066,7 +13067,8 @@ declare namespace ts { SharedModuleExportsWarning = 108, SendableBetaCompatible = 109, SendablePropTypeWarning = 110, - LAST_ID = 111 + ObjectLiteralAmbiguity = 111, + LAST_ID = 112 } class FaultAttributes { cookBookRef: number; @@ -13078,6 +13080,7 @@ declare namespace ts { function setTypeChecker(tsTypeChecker: TypeChecker): void; function clearTypeChecker(): void; function setTestMode(tsTestMode: boolean): void; + function setMixCompile(isMixCompile: boolean): void; function getStartPos(nodeOrComment: Node | CommentRange): number; function getEndPos(nodeOrComment: Node | CommentRange): number; function getHighlightRange(nodeOrComment: Node | CommentRange, faultId: number): [ @@ -13405,6 +13408,7 @@ declare namespace ts { private fileExportDeclCaches?; private compatibleSdkVersionStage; private compatibleSdkVersion; + private mixCompile; constructor(sourceFile: SourceFile, tsProgram: Program, tscStrictDiagnostics?: Map | undefined); static clearTsTypeChecker(): void; static clearQualifiedNameCache(): void; @@ -13423,6 +13427,8 @@ declare namespace ts { private interfaceInheritanceLint; private lintForInterfaceExtendsDifferentPorpertyTypes; private handleObjectLiteralExpression; + private handleUnionTypeObjectLiteral; + private getSourceFileFromType; private handleArrayLiteralExpression; private handleParameter; private handleEnumDeclaration; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0cac1ce9a6980de21dc927365fa758e005d63f2e..a47cbcd6959df26f1bd440a6108f44a210a33f02 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3397,6 +3397,7 @@ declare namespace ts { etsAnnotationsEnable?: boolean; maxFlowDepth?: number; skipOhModulesLint?: boolean; + mixCompile?: boolean; } interface EtsOptions { render: { @@ -9136,7 +9137,8 @@ declare namespace ts { SharedModuleExportsWarning = 108, SendableBetaCompatible = 109, SendablePropTypeWarning = 110, - LAST_ID = 111 + ObjectLiteralAmbiguity = 111, + LAST_ID = 112 } class FaultAttributes { cookBookRef: number; @@ -9148,6 +9150,7 @@ declare namespace ts { function setTypeChecker(tsTypeChecker: TypeChecker): void; function clearTypeChecker(): void; function setTestMode(tsTestMode: boolean): void; + function setMixCompile(isMixCompile: boolean): void; function getStartPos(nodeOrComment: Node | CommentRange): number; function getEndPos(nodeOrComment: Node | CommentRange): number; function getHighlightRange(nodeOrComment: Node | CommentRange, faultId: number): [ @@ -9475,6 +9478,7 @@ declare namespace ts { private fileExportDeclCaches?; private compatibleSdkVersionStage; private compatibleSdkVersion; + private mixCompile; constructor(sourceFile: SourceFile, tsProgram: Program, tscStrictDiagnostics?: Map | undefined); static clearTsTypeChecker(): void; static clearQualifiedNameCache(): void; @@ -9493,6 +9497,8 @@ declare namespace ts { private interfaceInheritanceLint; private lintForInterfaceExtendsDifferentPorpertyTypes; private handleObjectLiteralExpression; + private handleUnionTypeObjectLiteral; + private getSourceFileFromType; private handleArrayLiteralExpression; private handleParameter; private handleEnumDeclaration;