Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Disable Typescript's noImplicitAny only for .js files?

I want to keep noImplicitAny for .ts/.tsx files, but disable it for .js files. I don't want to disable the checkJs option because I still want it to check .js files.

Is this possible?

Here's my base tsconfig.json:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": true,
    "noEmit": true,
    "noEmitHelpers": true,
    "strict": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": "./",
    "noImplicitAny": true,
    "noImplicitOverride": true,
    "strictNullChecks": true,
    "useUnknownInCatchVariables": true,
    "resolveJsonModule": false,
    "types": ["node"],
    "experimentalDecorators": true,
    "noErrorTruncation": true,
    "composite": true
  },
  "include": [
    "."
  ],
  "exclude": [
    "./node_modules",
    "./build"
  ]
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Unfortunately, this is not something you can achieve like that. One way you could achieve that would be to have two tsconfig file.

So basically, the main tsconfig.json would do everything except checkJs and the second one (let's call it tsconfig.typeCheckJs.json) would add the checkJs, notImplicitAny and noEmit.

For example

// tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": false,
    "strict": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": "./",
    "noImplicitAny": true,
    "noImplicitOverride": true,
    "strictNullChecks": true,
    "useUnknownInCatchVariables": true,
    "resolveJsonModule": false,
    "types": ["node"],
    "experimentalDecorators": true,
    "noErrorTruncation": true,
    "composite": true
  },
  "include": [
    "."
  ],
  "exclude": [
    "./node_modules",
    "./build"
  ]
}

and another one

// tsconfig.typeCheckJs.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": true,
    "noEmit": true,
    "noEmitHelpers": true,
    "strict": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "baseUrl": "./",
    "noImplicitAny": false,
    "noImplicitOverride": true,
    "strictNullChecks": true,
    "useUnknownInCatchVariables": true,
    "resolveJsonModule": false,
    "types": ["node"],
    "experimentalDecorators": true,
    "noErrorTruncation": true,
    "composite": true
  },
  "include": [
    "."
  ],
  "exclude": [
    "./node_modules",
    "./build"
  ]
}

then, you need to update your scripts to something like this:

// package.json
scripts: {
    "build": "./node_modules/.bin/tsc --project tsconfig.typeCheckJs.json && ./node_modules/.bin/tsc"
}

Hope that it is clear, otherwise do not hesitate to ask for clarifications.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!