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

Control TSC's noEmit or emitDeclarationOnly when using composite projects #8551

Open
pleerock opened this issue Feb 25, 2020 · 7 comments · May be fixed by #10921
Open

Control TSC's noEmit or emitDeclarationOnly when using composite projects #8551

pleerock opened this issue Feb 25, 2020 · 7 comments · May be fixed by #10921

Comments

@pleerock
Copy link

create-react-app doesn't work in composite typescript projects, because for composite projects emitDeclarationOnly must be used instead of noEmit (when using noEmit: true and composite: true typescript compiler throws an error). I suggest to add a check - if typescript project is composite-based, use emitDeclarationOnly flag instead of noEmit.

See microsoft/TypeScript#36917 for more information.

@CodingDive
Copy link

Not entirely sure if this is related but I'm using lerna with TypeScript projects. In the root directory, I watch all packages with the --incremental flag which requires noEmit to be false. When I change noEmit: true, CRA adds it back.
Therefore, I needed to remove the --incremental flag which might negatively impact the performance of large TypeScript projects.

@pleerock
Copy link
Author

@CodingDive it is related.

@slikts
Copy link

slikts commented Mar 4, 2020

Options for incremental builds can look like this:

    "incremental": true,
    "emitDeclarationOnly": true,
    "outDir": ".cache/tsbuild",
    "skipLibCheck": true

Adding support for the incremental option was previously proposed in #6785, but was closed due to the webpack plugin already using incremental builds, but I think that misses the point; it's also useful to check types with tsc without building, since it's faster and allows to type check files that aren't open in an editor.

@youbek
Copy link

youbek commented Jun 8, 2020

Same here, I want to add composite to true, which cannot go with noEmit. so, I am trying to remove the noEmit, but CRA adding it back. Any solutions?

@CodingDive
Copy link

CodingDive commented Jun 30, 2020

@slikts that seems like a good config for incremental builds indeed. Unfortunately, as reported by @plreerock even emitDeclarationOnly won't work when CRA always sets noEmit back to true.

For anyone running into the same error: error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

@MichaelFroeschen
Copy link

This is still a thing... I'm kinda getting annoyed by the fact, that some options are forced in such a way, without any explanation...

@mikehardy
Copy link

@entropitor appears to have nailed this one with his PR. I checked it carefully and it fixes things for me 100%

I attached a patch-package file over on the PR for anyone to use while waiting for the PR to settle: #10921 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants