Reputation: 63
In the website https://react-typescript-cheatsheet.netlify.app/,I want learn more about the TS,so I want to run the Example code of TS,then I want I can get a result of these Example code,however ,I just get an error .
this is the link of one of the example code of Playground for TS: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wFgAoCpAD0ljkwFcA7DYCZuRgZyQBkIKACbBmAcwAUASjgBvCnDhoO3eAG1g3AcNFiANHF4wAyjBQwkAXTgBeRMRgA6HklPmkEzCgA2vKQG4FJRV4b0EhWzgJFAAFHBBNJAAuODjcRIAeFGYATwA+GRs8uSDFIzcLCRgoRiQA0rgiGEYoTlj4xMdMUR9vHIlpW2Lys0qvXzr68kUAX0DpxqRm1rgNLXDdAzDhaxRuYOZVfzgAehO4UUwkKH21ACMICG9UZgMYHLAkCEw4baFrUSqVARb5RB5PF5wAA+cHen1BfykaksFBmQA
after I click run,then I get an Error as follow:
[ERR] "Executed JavaScript Failed:"
[ERR]: Cannot use import statement outside a module
JavaScript language version is ES2020
Upvotes: 0
Views: 157
Reputation: 9485
I don't think you're reading the instructions carefully enough: the tutorial setup page says 'TypeScript Playground with React: just if you are debugging types (and reporting issues), not for running code' (my emphasis).
The CodeSandbox link on the next line seems to run the code fine with React in the cloud.
Upvotes: 1