Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include and exclude have no effect #207

Open
GreenDjango opened this issue Jul 27, 2023 · 1 comment · May be fixed by #243
Open

include and exclude have no effect #207

GreenDjango opened this issue Jul 27, 2023 · 1 comment · May be fixed by #243

Comments

@GreenDjango
Copy link

Hi,

tsconfig.json files specified using extends will have include and exclude paths relative to their location, as per the include docs:

These filenames are resolved relative to the directory containing the tsconfig.json file.

So a config like Next.js base install with npm will produce a typescript error:

error TS18003: No inputs were found in config file '/home/user/my-project/tsconfig.json'.
Specified 'include' paths were '["node_modules/@tsconfig/next/next-env.d.ts","node_modules/@tsconfig/next/**/*.ts",...]'
and 'exclude' paths were '["node_modules/@tsconfig/next/node_modules"]'.

for a tsconfig.json like:

{
  "extends": ["@tsconfig/next/tsconfig.json"],
}

Not specify include and exclude in base template can remove ambiguity

Have a nice day

@zetaraku
Copy link

Agreed. include and exclude in the @tsconfig/next/tsconfig.json file are useless and misleading.

Maybe we can remove that and provide this excerpt in the README file and instruct users to manually add it:

{
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

hyoretsu added a commit to hyoretsu/bases that referenced this issue Dec 29, 2023
@hyoretsu hyoretsu linked a pull request Dec 29, 2023 that will close this issue
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Jan 19, 2024
Summary:
This removes the 4 ineffective and redundant entries from the `exclude` list in `tsconfig.json` (`typescript-config` package).

These entries have no effect as they are relative to the typescript-config package. Explained in detail here: tsconfig/bases#207

A newly generated RN app shows this config:

```
$ yarn tsc --showConfig | grep -A 5 exclude
    "exclude": [
        "node_modules/tsconfig/react-native/node_modules",
        "node_modules/tsconfig/react-native/babel.config.js",
        "node_modules/tsconfig/react-native/metro.config.js",
        "node_modules/tsconfig/react-native/jest.config.js"
    ]
```

Clearly, none of these files exist, therefore to remove ambiguity and reduce the complexity of the config, they should be removed.

## Changelog:

[GENERAL] [REMOVED] - Remove ineffective excludes from typescript-config

Pull Request resolved: #42375

Test Plan:
- Create new RN app (`npx react-native init`), install dependencies, run `yarn tsc`
- It works
- Recreate config, but _without_ the `exclude` section
- Everything works exactly the same

Reviewed By: huntie

Differential Revision: D52904713

Pulled By: NickGerleman

fbshipit-source-id: d1d6f65b164053f9a1e611022178ced032a38aef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants