React 开发报错整理
创始人
2025-01-15 13:05:48
0

1、'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation.

function* handleSignin(action: SigninAction) {     console.log(action, 'handleSignin')     try{         let res: any = yield call(axios.post, `${API}/signin`, action.payload)         yield put(signinSuccess())     }catch(error:any) {         alert(error.response.data.error)         yield put(signinFail(error.response.data.error))     }      }
function* handleSignin(action: SigninAction): any {     console.log(action, 'handleSignin')     try{         let res: any = yield call(axios.post, `${API}/signin`, action.payload)         yield put(signinSuccess())     }catch(error:any) {         alert(error.response.data.error)         yield put(signinFail(error.response.data.error))     }      }

2、React Hook "useActive" is called conditionally. React Hooks must be called in the exact same order in every component render

function useActive(currentPath:string, path:string) {     return currentPath === path ? 'ant-menu-item-selected' : '' }  function getDashboardUrl() {     let url = '/user/dashboard'     if(isAuth()) {         const {             user: {role}          } = isAuth() as Jwt         if(role === 1) {             url = '/admin/dashboard'         }     }     return url } 
function getDashboardUrl() {     let url = '/user/dashboard'     if(isAuth()) {         const {             user: {role}          } = isAuth() as Jwt         if(role === 1) {             url = '/admin/dashboard'         }     }     return url }   function useActive(currentPath:string, path:string) {     return currentPath === path ? 'ant-menu-item-selected' : '' }

3、An interface can only extend an object type or intersection of object types with statically known members

是类和接口不能 implement / extends 联合类型的类型别名。就像你用 interface 去 extends 一个 class 或另一个 interface 是可以的,但是你不能去 extends 联合类型。

interface PrivateRouteProps extends RouteProps {}
type PrivateRouteProps = RouteProps & {}

4、An argument for 'defaultValue' was not provided

5、Argument of type 'RcFile | undefined' is not assignable to parameter of type 'string | Blob'.
Type 'undefined' is not assignable to type 'string | Blob'.

6、Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.

const {productId} = useParams<{ productId: string }>()     useEffect(() => {                  dispatch(getDetailProduct({productId}))     }, [])
const {productId} = useParams<{ productId: string }>()     useEffect(() => {         //dispatch(getDetailProduct({productId: productId!}))         dispatch(getDetailProduct({productId: productId as string}))     }, [])

相关内容

热门资讯

透视私人局!鱼扑克德州有没有挂... 透视私人局!鱼扑克德州有没有挂,HHpoker透视测试(详细辅助爆料教程)1、这是跨平台的鱼扑克德州...
透视线上!德扑最新发牌程序有规... 透视线上!德扑最新发牌程序有规律吗,扑克时间有没有挂的牌(详细辅助解说技巧)这是由厦门游乐互动科技有...
透视实锤!德扑偷鸡7个技巧,w... 透视实锤!德扑偷鸡7个技巧,wepoker透视挂作弊挂方法(详细辅助可靠教程);(需添加指定Q群10...
透视科技!wpk辅助工具,hh... 透视科技!wpk辅助工具,hhpoker透视方法,微扑克教程(有挂规律);1、进入游戏-大厅左侧-新...
智星德州辅助译码插件靠谱吗!w... 智星德州辅助译码插件靠谱吗!wepoker安装教程(透视)原来真的是有挂(安装教程);1、超多福利:...
透视实锤!aapoker有脚本... 您好,hhpoker万能辅助器这款游戏可以开挂的,确实是有挂的,需要了解加去Q群【106723914...
透视新版!wepokerplu... 1、透视新版!wepokerplus德州作弊,德州辅助app官方下载最新版本苹果(详细辅助高科技教程...
hhpoker怎么开透视!we... hhpoker怎么开透视!werplan免费挂下载(透视)竟然真的是有挂(安装教程)1、hhpoke...
透视科技!大菠萝游戏有挂吗,德... 大家肯定在之前德州HHpoker真的好假或者德州HHpoker真的好假中玩过透视科技!大菠萝游戏有挂...
辅助透视!德普之星透视辅助插件... 辅助透视!德普之星透视辅助插件,wepoker透视脚本免费,必胜教程(有挂方法);1、许多玩家不知道...