facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.27k stars 26.7k forks source link

Doesn't work with typescript 4.9 satisfies operator #12978

Open elderapo opened 1 year ago

elderapo commented 1 year ago

Describe the bug

Doesn't work with the typescript 4.9 satisfies operator.

Steps to reproduce

Add

const test = {} satisfies {};

anywhere in your CRA project.

Expected behavior

No syntax error.

Actual behavior

Syntax error.

GregoryBai commented 1 year ago

This 'satisfies' is really needed

vincentjames501 commented 1 year ago

+1. Running into the same issue.

fxOne commented 1 year ago

satisfies was added to babel@7.20: https://github.com/babel/babel/pull/14211

If you are using a lock file, you must ensure that you are using the latest version. With yarn, you can remove the lines of the subpackage you want to update and run a yarn install to update the latest subdependency.

You also need to clear the webpack/babel cache.

ranneyd commented 1 year ago

So I fixed this, but I'm not really sure how I did it 😂 . I was throwing a lot of stuff at the wall and seeing what stuck, and eventually it just worked. Things that I did:

I know this is not a great answer, but it did end up working!