Why is TypeScript not parsing my `react-native-web` code? (NOT using `create-react-native-app`)

给你一囗甜甜゛ 提交于 2019-12-25 02:20:22

问题


Already tried https://github.com/necolas/react-native-web/issues/832

Got:

for:

I thought the issue might be the linter error I was getting b/c of the react-native aliasing of react-native-web (which for some reason, TypeScript can't figure out...). Was able to resolve that via npm i -D react-native @types/react-native.

However, still got the same error.

Next, I tried converting my SFC (stateless functional component) to a class component. Still got:

So I'm wondering why I'm getting this error message even though I've configured TypeScript.


回答1:


This was my issue: In my tsconfig.json, I had "jsx": "preserve". Switching to "jsx": "react" fixed it!



来源:https://stackoverflow.com/questions/55231350/why-is-typescript-not-parsing-my-react-native-web-code-not-using-create-rea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!