-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
allow tsconfig to contain emitDeclarationOnly=true #10921
base: main
Are you sure you want to change the base?
Conversation
Hi @entropitor! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@ianschmitz @iansu @mrmckeb @petetnt Could you please review? |
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Who can review this PR? |
Hi @entropitor, are you able to use a |
@mrmckeb What do you mean? This script is working just fine as is, no need for a |
No, I tried it too but CRA updates A workaround is using pre/post scripts to manipulate tsconfig, but it isn't a good pratice and causes issues when we run more than one script (start, test) |
@ianschmitz @iansu @mrmckeb @petetnt What do I need to do to get this simple change in? |
I reviewed this carefully including reading related issues and documentation. A tsconfig with emitDeclarationsOnly=true, noEmit=false, incremental=true works great. Thank you so much for investigating this and fixing it @entropitor This should be merged, it appears most recent previous committers were @MadJose @VitorLuizC and @KonstantinSimeonov perhaps they can lend a hand. I'm attaching a diff in patch-package format - just remove the .txt extension I had to add so github would allow me to attach it - this allows me to apply this locally so I'm unblocked. Perhaps others may find it useful, patch-package is perfect for integrating changes locally while waiting for PR processes. |
This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is not stale. This PR functions correctly, seems to go along with the philosophy of the repo and is in use in production apps Please merge 🙏 |
@entropitor not sure if it would help, but you could perhaps rebase this against current master and push it back out, that might re-trigger the CI runs and perhaps they would build? At the moment the failing tests have been removed so it is not even possible to see if the failed builds were because of this or some other flakiness |
403211c
to
c6bc87f
Compare
@mikehardy done |
Nice! All green on the CI runs that don't need approval. I'm not a maintainer here, but hopefully that makes the PR look a little better for their limited attention. Cheers |
LGTM! 🚢 |
While the maintainers are away on vacation, anyone who really wants to get around this issue can try the following script ( import { addHook } from "pirates";
const matcher = (filename: string) => filename.endsWith("react-scripts/scripts/utils/verifyTypeScriptSetup.js");
addHook(() => "module.exports = () => {}", { ignoreNodeModules: false, matcher }); If you use craco, you can do |
Fixes #10796
Fixes #9373
Fixes #8551
Typescript project references are a useful feature in a monorepo that allow building sub-packages incrementally and don't require a rebuild of a dependency to get up-to date type information in the editor of that dependency.
However, for it to work, some fields need to be set in the tsconfig:
composite: true, incremental: true, emitDeclarationOnly: true
the last one is a problem because typescript errors when there is a field fornoEmit
and foremitDeclarationOnly
. This PR inspect the users' config, and if they already have aemitDeclarationOnly
, it needs to be set to the value true and if they don't the current behaviour is kept.I've tried copying this file to my local project's node_modules and now I can add
emitDeclarationOnly
without a problem (and thus without react-scripts overwriting my tsconfig)