-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
TypeScript 4 support #9515
Comments
This should get fixed in the next release as create-react-app/packages/react-scripts/package.json Lines 34 to 35 in 7763737
|
does babel/babel#11760 added support in 7.11 and
|
Another bug related to Using
Looks like the this project will have to move away from hot-rewriting the configuration, which imo is a good thing as I quite dislike the forced rewrite, I think we should just warn that you are running an unsupported configuration. |
Hitting the exact same issue after upgrading. As it was locally working I've realized a few other issues. I was trying to use the new After downgrading to TypeScript 3.9 again, the issue stays. I'm not fully sure if this is caused by TypeScript 4.0 anymore now. And I'm also stuck now. Also happening on CI. Edit: Okay, this is really weird. After deleting |
I found that when I had to downgrade back to 3.9 that just deleting the .cache folder from node_modules did the trick. |
Would be nice to add a workaround to the CRA website while the default typescript support is broken on fresh installs. |
I am asking here since this is really hard to find any information about, but it seems to be related to TypeScript 4.
If anyone has any pointers where i can find a solution for this, or workaround for that matter, i would be ever so grateful. |
The workaround is either to eject, to force the field resolution (which only seems to work with npm and not with yarn, but I might be wrong on this) or use a version < 4 |
My current workaround to use TypeScript 4+ is to use // Hacky way to disabled picky typescript setup verification
const originalModuleLoad = Module._load;
Module._load = function (request, parent) {
const originalReturn = originalModuleLoad.apply(this, arguments);
if (request.includes('verifyTypeScriptSetup')) {
return () => {};
}
return originalReturn;
}; Bonus with that is that you can finally use the tsconfig eg. "compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": ["src/*"],
"@foobar/library": ["./../library/src"],
"@foobar/library/*": ["./../library/src/*"]
}
}, |
I got it to work with yarn when downgrading to NOTE: this is not a fix to the problem, is a way to work around it. The real fix is patience and gratitude to those who create these awesome packages for us :) |
Still failing from a fresh install :
it works so far
then I had a weird error that I fixed with
then I update
Result :
|
Curiously, when I change to :
it works, but when I add the type :
it fails :( whereas it is not used |
@ppoulard this bug will only happen when using tuple types. In TypeScript’s Compiler API they renamed the property to access a tuple type’s type nodes so the code being executed here is referencing the old property name. So that said, this bug can be worked around by not using tuple types, but that may not be feasible or desired in many cases. |
@ppoulard, you're still using the stable version of CRA that was released some time ago and does not support TypeScript 4. You can try out the CRA@4 alpha by doing this: npx create-react-app@next test-app --scripts-version react-scripts@next --template typescript --use-npm
npm i -S typescript@latest I added your code and it worked fine. |
Thanks, I will wait for the stable release then ! |
By the way, where is CRA v3.4.3 release? |
@ryota-murakami, I don't think they made a GitHub release. The changes are in here though (3.4.2 & 3.4.3): https://github.com/facebook/create-react-app/blob/master/CHANGELOG.md |
@sheepsteak Thanks! |
Have you solved this issue? I want to upgrade Typescript >=4.x |
I decided to wait for CRA v4 😬 and privately I'm playing around with different solutions like Next JS. |
Has anyone tried it with CRA 3.4.4 ? |
@onionhammer I tried it yesterday and still got the same error. 3.4.4 just bumped |
Fixed in Create React App 4.0. |
I still can't use typescript 4.
|
Temporary solution: It was fixed in #9964 |
For those that are upgrading:
And are having the compiler throw up on everything, I checked my
Putting that in (in addition to upgrading all libraries as well as the |
Describe the bug
After updating to
typescript@4.0.2
withreact-scripts@3.4.1
(I also tried version3.4.3
where I couldn't find any release notes) the followingeslint
error occurred:This happened only after deleting all of my
node_modules
and recreating thepackage-lock.json
from scratch.It seems to be related to
@typescript-eslint/eslint-plugin
. And I don't know why but the referenced versions inreact-scripts
seems to be very old. Fromreact-scripts@3.4.1
package.json
:Current versions of
@typescript-eslint/eslint-plugin
and@typescript-eslint/parser
are as of now3.9.1
.The text was updated successfully, but these errors were encountered: