Recibí este error mientras ejecutaba yarn start:
$ yarn start
yarn run v1.22.17
$ run-s build exec
$ babel src/ -d lib/
SyntaxError:.../src/App.js: Expected an arrow function after this type parameter declaration. (8:9)
6 |
7 | export default function App(): React$MixedElement {
> 8 | return <p>Hello, React!</p>;
| ^
9 | }
10 |
A continuación se muestran las configuraciones:
paquete.json
"scripts": {
"flow": "flow",
"start": "run-s build exec",
"exec": "node lib/index.js",
"build": "babel src/ -d lib/",
},
babel.config.json:
{
"presets": ["@babel/preset-flow"],
"plugins": ["babel-plugin-transform-flow-enums"],
"targets": {
"esmodules": true
}
}
Aplicación.js:
// @flow
import "./App.css";
import React from "react";
export default function App(): React$MixedElement {
return <p>Hello, React!</p>;
}
¿Cuál es el problema con mis configuraciones y mi archivo de reacción?
Solución del problema
Parece ser un error tipográficoReact.MixedElement, reemplace el $por un .:
export default function App(): React.MixedElement {...}
No hay comentarios:
Publicar un comentario