-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Referenced project ... must have setting "composite": true #27292
Comments
I have the same error, this only popped up recently like a month or two ago or so. |
@arndwestermann, this has to do with the introduction of 'composite' in Typescript. It's not something I tend to spend a lot of time thinking about. I just want it to work. I can't find where I found this but this arrangement seems to work. In
And then in `
}, The problem I have is I think the Nx generators should do this for us. |
@chriscurnow I think it is just sufficient enough to add this "compilerOptions": {
"declaration": true,
"composite": true,
"emitDeclarationOnly": true,
...
}, to the EDIT: @chriscurnow hm your solution unfortunately doesn't seem to work as I initially thought, even with putting also these flags into the app/lib configs, I'm getting a ton of these errors when I try to prod build the libs/apps
If I understand it correctly It wants me to use the |
I also have this problem and is very annoying. All libs are red flagged. |
Same error here since several weeks |
Same here |
same problem here any news? |
+1 |
I think not using the It is annoying the IDE complains about it but it does not affect or causes any other issues than just the IDE complaining. Please add information or correct me if this is wrong. I would also love if someone has a solution to keep VSCode silent on this. |
what helped in my case was downgrading typescript to |
maybe @juristr can clarify this... 🤷 Thanks in advance |
More than two months of this issue and no solution? |
helpp |
I would simply ts-ignore it, until we find the better solution :)
|
I was also troubled by the same error, but it seems to have stopped occurring after I disabled the VSCode Plugin NX Console. This plugin might be the cause of the issue. |
We have the same problem. The problem is no longer shown in VSCode when the NX Console version v18.24.1 is used. Downgrading may be a workaround, but I agree with the issue creator, the problem shouldn't be there. In the IDE, especially for new project participants, it looks like they did something wrong/something is not working. |
My version is v20.0.5 but the error still occurs. |
this error keeps occuring from time to time, editing the file and saving it again makes the error goes away, but it's pretty annoying |
This worked for me. I miss using Nx console options but could not stand seeing the annoying error. Whole VS Code was lit up. |
Really annoying - happens for us too |
+1 |
https://nx.dev/nx-api/js/documents/typescript-project-references According to the Doc, they say 'composite' value should be true. I changed the value to true. |
And now, you cannot compile. |
I've been facing the same error in my Nx monorepo with Nx Console and VS Code for the past two years. Interestingly, my colleagues using WebStorm don't encounter this issue. We don't use the composite flag in our configuration. I'm not entirely sure where the issue lies, or on which side it has to be fixed. it’s more of an annoyance, as it doesn’t affect compilation or functionality. |
@morgan-wild what solved the compiling issue for me (in my React / Vite app) was:
|
This works for me for building Angular libs + using vitest + [email protected]:
// Note: tsconfig-angular.base.json is just an normal tsconfig file for Angular that I share across multiple libs and apps
{
"extends": "../../tsconfig-angular.base.json",
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true, // THIS IS IMPORTANT
"composite": true, // THIS IS IMPORTANT
"declarationMap": true,
"outDir": "../../../dist/out-tsc",
"inlineSources": true,
"types": []
},
"exclude": [
"src/**/*.spec.ts",
"src/test-setup.ts",
"jest.config.ts",
"src/**/*.test.ts",
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/test-setup.ts"
],
"include": ["src/**/*.ts"]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true, // THIS IS IMPORTANT
"composite": true, // THIS IS IMPORTANT
"outDir": "../../dist/out-tsc",
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"]
},
"include": [
"vite.config.ts",
"vite.config.mts",
"vitest.config.ts",
"vitest.config.mts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
],
"files": ["src/test-setup.ts"],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declaration": false, // THIS IS IMPORTANT
"composite": false // THIS IS IMPORTANT
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
} The idea is pretty simple. We need |
any progress on this problem from nx side? |
That doc is only for the Nx workspaces that utilize the new TypeScript Project References. However, at this point it's not fully supported yet. From the same blog post:
Furthermore, I also think this is intended to be false by Nx (for non-TypeScript-Project-References workspaces) for reasons stated in a previous comment. To sum it up, we just need to bare with the IDE errors until somebody manages to address it somehow or until Nx starts fully supporting TypeScript Project References and we manage to migrate our existing workspaces to it. |
I usually keep the NX Console plugin disabled and only enable it when I need to generate apps or libraries. This isn't a perfect solution but helps eliminate the red squiggly lines, ensuring errors only appear for genuine compilation issues. Additionally, I’ve noticed that the cursor responds faster with the plugin disabled. |
The error doesn't come from the plugin. I don't have the plugin enabled, yet I still have these errors. |
Current Behavior
My
tsconfig
files report an error:Referenced project ... must have setting "composite": true.
Expected Behavior
Automatically generated
tsconfig
files should be error free.GitHub Repo
No response
Steps to Reproduce
tsconfig
file. I won't be working in thetsfonfig
file. The error just appears.Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
I realise this report is essentially the same as #20957 but I don't believe it should have been closed.
The error persists in automatically generated tsconfig files.
This is a bug.
The comment referenced a link which no longer exists: #20957 (comment).
@jaysoo commented here #20957 (comment), that we were free to add composite:true, but
This should be handled by the generators.
The text was updated successfully, but these errors were encountered: