-
Notifications
You must be signed in to change notification settings - Fork 12.8k
tsconfig noEmit error: Cannot reference tsconfig if it extends other tsconfig. #49844
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
Comments
facing the same issue and is driving me crazy :( |
For me it doesn't affect anything. Just a visual error in vscode, so it's fair enough to place a comment with linking this issue above |
This configuration doesn't make any sense; every behavior of having a reference is dependent on the output files of the referenced project being present. What are you trying to achieve? |
Question: is there an easy way to type-check with a single |
No |
Of course this configuration doesn't make any sense. Because this is not a configuration but a minimal reproduction of the issue. If you need to see my full production setup, I've added all configs to the |
That doesn't really answer my question, I guess. Referencing a project does the following:
|
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Nice. |
add
in base config get rid of the error message |
@RyanCavanaugh, based on @ZerdoX-x's other comments, I'm assuming that the goal is to have type checking for test files without including them in the project's output. At least, that's what I need, and that's how I stumbled upon this issue. TypeScript's Project Reference Documentation suggested to me that Project References were the way to handle monorepos in NPM, keep TS working with tests, and keep the test files out of the build directory simultaneously. (Developers shouldn't need to include a If you aren't going to reopen the issue, would you be willing to give a reasonable alternative? Maybe there's something we're missing? |
What also might be coming out is a desire for simplicity. To expound a little more, many people want the ability to say, "Type Check my entire monorepo" in one command. But that gets difficult when there are files intended to be included in the output (regular files from several scoped packages) and files not intended to be in the output (such as test files and configuration files). Maybe clarity on what the recommendation is for monorepos would also be helpful? My goal is to avoid getting caught up in the chaos of |
In my head the ideal solution is just having an option to make |
Solution for us was to configure a base {
"$schema": "https://json.schemastore.org/tsconfig",
"files": [],
"references": [
{ "path": "./tsconfig.root.json" },
{ "path": "./scripts/tsconfig.json" }
]
} Then the error message Check out some examples:
|
Came here through Google, none of the suggested solutions so far helped me out. For me, I had to add |
@tylim88 @karlhorky Unfortunately, your solution seems to fall flat in a "triangular dependencies" situation, i.e. when my main @karlhorky In particular, @RyanCavanaugh's demo that you linked to does not disable emit. The tsconfigs explicitly specify EDIT: In light of what @RyanCavanaugh wrote here, this makes sense: Project references rely on emitting declarations.ΒΉ I have therefore updated my code example to fix the "noEmit" error by enabling ΒΉ) If the individual projects don't actually reference each other (like they do in my code example), i.e. if only the main |
@atollk |
@ZerdoX-x Have you found a solution for SvelteKit projects?
I am attempting to differentiate tsconfig(s) for universal and server modules, but cannot enable |
afaik i created separate tsconfigs for source and config files. same for tests Now I don't suffer from this issue. Maybe I could compare my current project configs with repro but seems like your's different.
this was the hardest for me. how to merge some options, override extend ntc. somehow i managed to handle that tooling and also I don't use vscode now either, moved to neovim |
Thanks! π |
Bug Report
π Search Terms
π Version & Regression Information
Tried
4.8.0-beta
,4.7.3
,4.7.4
, and4.6.3
β― Playground Link
π» Code
Couldn't reproduce this in Bug Workbench, but here is my minimal reproduction repo:
https://github.com/ZerdoX-x-issue-reproducer/microsoft-TypeScript-49844
tsconfig.json:
tsconfig.test.json:
tsconfig.base.json:
π Actual behavior
π Expected behavior
π€ Other info
SO question
UPDATE: Since this issue keeps receiving comments and attention, I would like to let you know that I don't suffer from this issue anymore, but reproduction will be opened as long as my account exists :) Afair I was using SvelteKit and I just wanted to get proper type checking for all of my files: 1) source files which would or would not get bundled to be running on client and/or server 2) configuration files, where some files use ESM, some still support only CJS 3) tests.
In newer projects I achieve this goal and do not stumble upon this issue, also it got easier now since new ESLint flat config which will be released in next major release.
The text was updated successfully, but these errors were encountered: