What is the default value for tsconfig "include"?

Viewed 477

In my react native project I'm using this library v1 and in the docs it says to add "include": ["node_modules/react-native-redash/lib/typescript/v1/index.d.ts"] to make the types work, and adding that does solve the problem with the library types, but adds another problem.

When I add that include, Typescript will only look at the files in the include and ignoring all the rest.

I checked the "include" description:

Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later.

And it says that if I don't add any, the default is all files except the exclude. But by adding an include, the default is gone and I lose the default files.

So my question is:

How can I specify the default value of include property + node_modules/react-native-redash/lib/typescript/v1/index.d.ts? What would be the default value for include?

What I have tried so far is doing something like

"include": [
  "node_modules/react-native-redash/lib/typescript/v1/index.d.ts",
  "./src"
],

But if I add any other path in include together with the redash one, all redash errors happen again.

2 Answers

To lint extra files without overriding the defaults...

  • Create a file at the root of your directory named tsconfig.eslint.ts.
  • Add to the file.
    {
      "include": [
        "node_modules/react-native-redash/lib/typescript/v1/index.d.ts",
        // other files or directories to include.
      ]
    }
    
  • Add to your eslint config file.
    parserOptions: {
      project: ["./tsconfig.json", "./tsconfig.eslint.json"],
    },
    

Here are the docs on the include glob patterns.

Related