typescripttsconfig

With tsconfig.json, is there in option to have stricted settings for some of the files?


here is my tsconfig.json:

{
  "compilerOptions": {
    "allowArbitraryExtensions":true,
    "target": "ES2021",
    "lib": [
       "ES2021", "dom", "dom.iterable"
    ],
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "strictFunctionTypes": true
    
  },
  "lib": ["ES2021"],
  "exclude": ["node_modules", "dist","tmp"]
}

This works fine for me, but i would like to have stricter rules for subset of my project. chiefly "noImplicitAny": true,

Is it at all possible?


Solution

  • This is possible:

    Define another tsconfig.json is the said subfolder.

    {
      "extends": "../../../tsconfig.json", //To have the same rules as the main project
      "compilerOptions": {
        "noImplicitAny": true, //extra rules
      },
      "include": ["*"]
    }
    

    Just make sure you extend it correctly. We want extension to work so that this subfolder follows all the rules of the main project and overrides only the essential ones.