diff --git a/package.json b/package.json index 8897e21..5d10c22 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "rimraf": "5.0.5", "tsconfig-plantain": "0.0.2", "tsx": "3.12.10", - "typescript": "5.3.3", + "typescript": "5.4.2", "vscode": "1.1.37" }, "scripts": { @@ -34,6 +34,6 @@ ], "private": true, "typeCoverage": { - "atLeast": 99.5 + "atLeast": 99.52 } } diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 56be2e0..b5f3008 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -362,7 +362,7 @@ async function saveHistory(percentage: number, historyFile?:string) { const historyFilePath = path.resolve(process.cwd(), historyFile); if (await existsAsync(historyFilePath)) { const date = new Date().toISOString() - const historyFile = JSON.parse((await readFileAsync(historyFilePath)).toString()); + const historyFile: Record = JSON.parse((await readFileAsync(historyFilePath)).toString()); historyFile[date] = percentage await writeFileAsync(historyFilePath, JSON.stringify(historyFile, null, 2) + '\n'); } else { diff --git a/packages/core/src/checker.ts b/packages/core/src/checker.ts index 005747d..8e881d7 100644 --- a/packages/core/src/checker.ts +++ b/packages/core/src/checker.ts @@ -139,9 +139,7 @@ function checkTypeAssertion(node: ts.Node, context: FileContext, kind: FileAnyIn return } // exclude safe type assertion powered by isTypeAssignableTo - const checker = context.checker as unknown as { - isTypeAssignableTo?: (type1: ts.Type, type2: ts.Type) => boolean - } & typeof context.checker + const checker = context.checker if (checker.isTypeAssignableTo && checker.isTypeAssignableTo(checker.getTypeAtLocation(node.expression), checker.getTypeFromTypeNode(node.type))) { return diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index 181e4c7..41533f2 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -8,14 +8,15 @@ function init(modules: { typescript: typeof tsserverlibrary }) { const proxy: tsserverlibrary.LanguageService = { ...info.languageService, getSemanticDiagnostics(fileName) { - if (!info.config?.jsEnable && (fileName.endsWith('.js') || fileName.endsWith('.jsx'))) { + const config: { jsEnable: boolean } = info.config + if (!config?.jsEnable && (fileName.endsWith('.js') || fileName.endsWith('.jsx'))) { return [] } const result = lintSync( info.project.getCompilerOptions(), info.project.getRootFiles(), { - ...info.config, + ...config, files: [fileName], oldProgram, }, diff --git a/yarn.lock b/yarn.lock index db4ac32..f73f163 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2032,6 +2032,11 @@ typescript@5.3.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== +typescript@5.4.2: + version "5.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" + integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== + uc.micro@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.0.0.tgz#84b3c335c12b1497fd9e80fcd3bfa7634c363ff1"