Comments (9)
看看文件后缀是否为.tsx
或者.jsx
,如果是.ts
则需要改成.tsx
from foca.
是tsx文件,使用你的taro demo没报红,但删除yarn.lock,再install也会报红
from foca.
请提供一个最小仓库以供测试,不然没法知道发生了什么事。
from foca.
是tsx文件,使用你的taro demo没报红,但删除yarn.lock,再install也会报红
我试一下
from foca.
demo 直接install不会报红,删除yarn.lock,再install,会报红。
from foca.
知道原因了。react-redux的依赖中包含了 @types/react
的版本为*
通配符,这直接导致安装了@types/react@18版本,lock文件展示如下:
"@types/react@*":
version "18.0.9"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
"@types/react@^17.0.2":
version "17.0.45"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.45.tgz#9b3d5b661fd26365fefef0e766a1c6c30ccf7b3f"
integrity sha512-YfhQ22Lah2e3CHPsb93tRwIGNiSwkuz1/blk4e6QrWS0jQzCSNbGLtOEYhPg02W0yGTTmpajp7dCTbBAMN3qsg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
目前Taro是还没有兼容到18的,所以我们需要把18的类型移除
-"@types/react@*":
- version "18.0.9"
- resolved "https://registry.yarnpkg.com/@types/react/-/react--18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
- integrity sha512--9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
- dependencies:
- "@types/prop-types" "*"
- "@types/scheduler" "*"
- csstype "^3.0.2"
-"@types/react@^17.0.2":
+"@types/react@*", "@types/react@^17.0.2":
version "17.0.45"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.45.tgz#9b3d5b661fd26365fefef0e766a1c6c30ccf7b3f"
integrity sha512-YfhQ22Lah2e3CHPsb93tRwIGNiSwkuz1/blk4e6QrWS0jQzCSNbGLtOEYhPg02W0yGTTmpajp7dCTbBAMN3qsg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
这个版本我控制不了,目前只能这样做,我这边也看看有没有更好的解决方案
from foca.
好的
from foca.
方案二,在package.json
中加入如下配置即可:
{
"resolutions": {
"foca/react-redux/@types/hoist-non-react-statics/@types/react": "^17"
}
}
from foca.
谢谢,已经解决。
from foca.
Related Issues (20)
- Cannot find namespace 'NodeJS' HOT 3
- add support of undefined type in initialState HOT 4
- 如何在modelA里访问modelB的数据? HOT 4
- 使用时出现action in action的小问题 1.0.0 HOT 23
- 一定要在 effects 中使用 this.setState 或者 先定义 actions 方法调用才能更新状态吗 HOT 6
- 关于持久化的版本号 HOT 7
- 多个loading的情况 HOT 1
- [New Feature]是不是可以增加一个即用即创建的功能 HOT 6
- [Improvement] reset的特性无需深拷贝 HOT 3
- [New Feature]响应式 支持对复杂对象的支持 HOT 2
- initialState参数很多,如何一次性setState更新? HOT 3
- actions,异步actions, reducer, methods, computed, watch 名称叫法 HOT 1
- 如何动态删除指定的缓存? HOT 1
- foca 2.0 规划
- 持久化没有把initvalue放进去 HOT 3
- onInit不会触发useLoading HOT 2
- taro 支付宝小程序不支持吗? HOT 9
- foca2 在低版本的手机有兼容问题,iphone6和部分oppo HOT 9
- 有办法删除Model吗? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foca.