From e8f8b0a48ebdbd8fcd1b184e1021889ce0b51c17 Mon Sep 17 00:00:00 2001 From: Fernando van Loenhout Date: Thu, 23 Mar 2023 12:25:18 +0100 Subject: [PATCH] Add support for typescript in the CheckJS mode In the checkJs mode, typescript will also check your JavaScript files using the types inside the JsDoc comments. At the moment, you cannot pass a .js files to tsc-files, because it gives the following error: error TS5042: Option 'project' cannot be mixed with source files on a command line. This is because the js files are appended after the tsc command. This commit allows the tsc-files plugin to also work with the checkJs mode --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index f606859..57e9220 100755 --- a/lib/index.js +++ b/lib/index.js @@ -9,7 +9,7 @@ const args = process.argv.slice(2) const argsProjectIndex = args.findIndex(arg => ['-p', '--project'].includes(arg)) // prettier-ignore const argsProjectValue = argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : undefined // prettier-ignore -const files = args.filter(file => /\.(ts|tsx)$/.test(file)) +const files = args.filter(file => /\.(ts|tsx|js|jsx)$/.test(file)) if (files.length === 0) { process.exit(0) }