Repository: create-react-app
Issue: ERROR in src/App.tsx:6:20 TS2802: Type 'Set<string | number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
Labels: needs triage,issue: bug report

<!--
    Please note that your issue will be fixed much faster if you spend about
    half an hour preparing it, including the exact reproduction steps and a demo.

    If you're in a hurry or don't feel confident, it's fine to report bugs with
    less details, but this makes it less likely they'll get fixed soon.

    In either case, please use this template and fill in as many fields below as you can.

    Note that we don't provide help for webpack questions after ejecting.
    You can find webpack docs at https://webpack.js.org/.
-->

### Describe the bug
In a vanilla create-react-app typescript project (  `npx create-react-app my-app --template typescript` ), valid code for iteration is rejected:
```
TS2802: Type 'Set<string | number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
    4 |
    5 | function App() {
  > 6 |   const bazz = [...new Set(["foo","bar",2])];
      |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    7 |   return (
```
a solution is to add downlevelIteration: true to tsconfig or target: "es6" (equivalent "es2015") to tsconfig.json, but it should work by default ? It seems it was the goal of https://github.com/facebook/create-react-app/issues/5684 . Also It's unclear to me what the best option is between setting target or setting downleveliteration. Also if not using target, is there other code syntax that is reject or is downleveliteration the only problem ?

### Did you try recovering your dependencies?
Fresh install

### Which terms did you search for in User Guide?
downlevelIteration
target es6
target es2015 (equivalient)

### Environment

<!--
  To help identify if a problem is specific to a platform, browser, or module version, information about your environment is required.
  This enables the maintainers quickly reproduce the issue and give feedback.

  Run the following command in your React app's folder in terminal.
  Note: The result is copied to your clipboard directly.

  `npx create-react-app --info`

  Paste the output of the command in the section below.
-->
```
$ npx create-react-app --info
npx : 67 installé(s) en 7.139s

Environment Info:

  current version of create-react-app: 5.0.1
  running from /home/harperjon/.npm/_npx/1316987/lib/node_modules/create-react-app

  System:
    OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  Binaries:
    Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
    Yarn: Not Found
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npm
  Browsers:
    Chrome: 108.0.5359.98
    Firefox: 100.0.2
  npmPackages:
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    react-scripts: 5.0.1 => 5.0.1 
  npmGlobalPackages:
    create-react-app: Not Found
```

### Steps to reproduce

(Write your steps here:)

1. $ npx create-react-app my-app --template typescript
2. write `const bazz = [...new Set(["foo","bar",2])];`
3.

### Expected behavior

Forked TS doesn't report an error (the emitted code by webpack works) (also it works in javascript)

### Actual behavior

<!--
  Did something go wrong?
  Is something broken, or not behaving as you expected?
  Please attach screenshots if possible! They are extremely helpful for diagnosing issues.
-->

Forked TS reported an error:
```
TS2802: Type 'Set<string | number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
    4 |
    5 | function App() {
  > 6 |   const bazz = [...new Set(["foo","bar",2])];
      |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    7 |   return (
```


### Reproducible demo

<!--
  If you can, please share a project that reproduces the issue.
  This is the single most effective way to get an issue fixed soon.

  There are two ways to do it:

    * Create a new app and try to reproduce the issue in it.
      This is useful if you roughly know where the problem is, or can’t share the real code.

    * Or, copy your app and remove things until you’re left with the minimal reproducible demo.
      This is useful for finding the root cause. You may then optionally create a new project.

  This is a good guide to creating bug demos: https://stackoverflow.com/help/mcve
  Once you’re done, push the project to GitHub and paste the link to it below:
-->

(Paste the link to an example project and exact instructions to reproduce the issue.)
https://codesandbox.io/s/cra-downleveliteration-or-es6-6q6cv3

<!--
  What happens if you skip this step?

  We will try to help you, but in many cases it is impossible because crucial
  information is missing. In that case we'll tag an issue as having a low priority,
  and eventually close it if there is no clear direction.

  We still appreciate the report though, as eventually somebody else might
  create a reproducible example for it.

  Thanks for helping us help you!
-->