From 5c5c9726c6c71cf2a53f67183ea5e16864a77c26 Mon Sep 17 00:00:00 2001 From: Wee Bit Date: Sun, 13 Aug 2023 16:47:38 +0200 Subject: [PATCH] Fix typescript-checkJS script --- lib/suggestSimilar.js | 2 ++ package.json | 2 +- tsconfig.checkJs.json | 14 ++++++++++++++ tsconfig.json | 34 ++++++++++++++++++---------------- 4 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 tsconfig.checkJs.json diff --git a/lib/suggestSimilar.js b/lib/suggestSimilar.js index 9a4066c71..75a527700 100644 --- a/lib/suggestSimilar.js +++ b/lib/suggestSimilar.js @@ -1,3 +1,5 @@ +// @ts-check + const maxDistance = 3; function editDistance(a, b) { diff --git a/package.json b/package.json index 0d7168fc2..9c0536f34 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test": "jest && npm run test-typings", "test-esm": "node ./tests/esm-imports-test.mjs", "test-typings": "tsd", - "typescript-checkJS": "tsc --allowJS --checkJS index.js lib/*.js --noEmit", + "typescript-checkJS": "tsc -p tsconfig.checkJs.json", "test-all": "npm run test && npm run lint && npm run typescript-checkJS && npm run test-esm" }, "files": [ diff --git a/tsconfig.checkJs.json b/tsconfig.checkJs.json new file mode 100644 index 000000000..3bee52768 --- /dev/null +++ b/tsconfig.checkJs.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noImplicitAny": false, + "noImplicitThis": false + }, + "include": [ + "**/*.ts", + "index.js", + "lib/**/*.js" + ] +} diff --git a/tsconfig.json b/tsconfig.json index d2688174b..59aa560f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "types": [ - "node", - "jest" - ], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["**/*.ts"], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "types": [ + "node", + "jest" + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "**/*.ts" + ] }