TypeScript Version: 3.7.0-beta
Search Terms: composite noEmit monorepo
Expected behavior:
In 3.6 I was able to compile with those 2 options enabled now in 3.7 beta I cannot do that anymore.
Actual behavior:
error TS5053: Option 'noEmit' cannot be specified with option 'composite'.
Related Issues: No?
@sheetalkamat this breaks vstsc for projects with composite because the task adds noEmit to the commandline
As part of it's incremental compilation, VS runs a pass with --listEmittedFiles --listFiles --noEmit. cc @uniqueiniquity
interesting.. Technically with --noEmit shouldn't listEmittedFiles be empty list?
@sheetalkamat, I would think so too, but @uniqueiniquity or @PranavSenthilnathan would know more about why it's there.
It should - I don't think --listEmittedFiles necessarily needs to be part of that pass.
The issue seems to be back in 3.8.2.
The revert was reverted again in https://github.com/microsoft/TypeScript/pull/36483 because, per https://github.com/microsoft/TypeScript/issues/32882, it _really_ doesn't make sense to have incremental and noEmit together, since noEmit prevents us from writing incremental metadata. (So nothing is actually incremental).
You should consider emitDeclarationOnly instead of noEmit, if you actually just want incremental checking.
Thank you. It makes sense.
For other readers: the parameter to use is emitDeclarationOnly (_declaration_ is singular).
I'm still not sold on this. I used noEmit within our tests folder, because we _don't_ want test files being compiled, nor generating declaration files. Now this pattern isn't possible without using a ton of gitignore patterns.
It also breaks other tooling like ESLint as these built files are now being pulled in, so we must configure rules against this also.
I am in the exact same situation as you are; I was using noEmit with incremental on test files. However the point is that you're not actually benefiting from incremental if you are not emitting declaration files.
Now this pattern isn't possible without using a ton of gitignore patterns. (...) It also breaks other tooling like ESLint as these built files are now being pulled in (...)
I wonder about the specifics of your project. For ours, all build artifacts are in a build/ folder. It is ignored by both git and ESLint. When setting emitDeclarationOnly for test files, I didn't have to change anything as the declaration files were emitting alongside the normal code.
The only thing I have to add is something to delete these declaration files when publishing.
This isn't the project, but a similar setup: https://github.com/airbnb/lunar/blob/master/packages/core/test/tsconfig.json Each test folder has its own tsconfig.json, separate from the package itself, since it has different requirements.
Now that incremental emits files, it's converting our test files to js, like foo.test.ts -> foo.test.js, which resulted in ESLint running against all of these new js files (and failing a ton). I got around this with emitDeclarationOnly: true, and gitignoring the d.ts files, but it still feels super ugly.
I got around this with emitDeclarationOnly: true, and gitignoring the d.ts files, but it still feels super ugly.
You can also use the declarationDir option to dump the declaration files in a cache directory that's easier to ignore, if you'd prefer.