Open chriscurnow opened 3 months ago
I have the same error, this only popped up recently like a month or two ago or so.
You can do a Restart Extension Host
in VSCode, but if I make any changes to a lib or app, for example add a new file, this error comes back again. I hadn't any trouble with that a while ago, but right now this is really annoying.
@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 tsconfig.base.json
, include
"compilerOptions:{ "declaration": true, "composite": true, "emitDeclarationOnly": true, }
And then in tsconfig.app.json
or tsconfig.lib.json
include
` "compilerOptions": {
"emitDecoratorMetadata": true,
"composite": true,
"declaration": true,
"declarationMap": true,
}, }`
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 tsconfig.base.json
, since any tsconfig.app.json
/tsconfig.lib.json
extend the local tsconfig.json
which extends the tsconfig.base.json
, at least this got already rid of the errors. Thanks for that.
I agree, this IMOH should be done by the nx generator or by a migration.
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
libs/shared/src/lib/util/index.ts:14:15 - error TS6307: File '[REDACTED]/libs/shared/src/lib/util/rxjs.util.ts' is not listed within the file list of project '[REDACTED]/libs/shared/tsconfig.lib.prod.json'. Projects must list all files or use an 'include' pattern.
export * from './rxjs.util';
If I understand it correctly It wants me to use the include: []
property to specify the files. but since tsconfig.lib.prod.json
extends tsconfig.lib.json
which has this "include": ["src/**/*.ts"]
it should work or am I missing something?
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 composite: true
option is intended by NX.
As setting it to true will make tsc
to compile all of the referenced packages at once and depends on their code. However in a monorepo setup, as it goes for NX, we want to be able to compile packages individually and not treat everything as one connected thing.
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 5.5.3
, the issue only appeared in my case with 5.5.4
maybe @juristr can clarify this... 🤷
Thanks in advance
More than two months of this issue and no solution?
helpp
Any progress or ideas on this one?
I think not using the
composite: true
option is intended by NX. As setting it to true will maketsc
to compile all of the referenced packages at once and depends on their code. However in a monorepo setup, as it goes for NX, we want to be able to compile packages individually and not treat everything as one connected thing.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.
I would simply ts-ignore it, until we find the better solution :)
"references": [
// @ts-ignore -> https://github.com/nrwl/nx/issues/27292
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
],
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
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: https://github.com/nrwl/nx/issues/20957#issuecomment-1873769215. @jaysoo commented here https://github.com/nrwl/nx/issues/20957#issuecomment-1883587356, that we were free to add composite:true, but