小编Tus*_*rat的帖子

类型“(dispatch: Dispatch<ShopDispatchTypes>) => Promise<void>”的参数不可分配给“AnyAction”类型的参数

错误:

\n
Argument of type \'(dispatch: Dispatch<ShopDispatchTypes>) => Promise<void>\' is not assignable to parameter of type \'AnyAction\'.\nuseEffect(() => {\n  dispatch(GetShops());\n}, []);\n
Run Code Online (Sandbox Code Playgroud)\n

我正在尝试使用 Typescript 实现 redux-thunk。我使用react、typescript和redux-thunk创建了简单的购物卡应用程序,但遇到了上述问题。\n下面是我的代码片段\xe2\x80\x99s。如果您需要更多信息,请随时询问。

\n

商店.actionTypes.ts

\n
export const SHOP_LOAD_START = \'SHOP_LOAD_START\';\nexport const SHOP_LOAD_SUCCESS = \'SHOP_LOAD_SUCCESS\';\nexport const SHOP_LOAD_ERROR = \'SHOP_LOAD_ERROR\';\n\nexport type Shop = {\n id: string;\n name: string;\n};\n\nexport type ShopType = {\n shops: Shop[];\n};\n\nexport interface ShopLoadStart {\n type: typeof SHOP_LOAD_START;\n}\n\nexport interface ShopLoadError {\n type: typeof SHOP_LOAD_ERROR;\n}\n\nexport interface ShopLoadSuccess {\n type: typeof SHOP_LOAD_SUCCESS;\n payload: ShopType;\n}\n\nexport type ShopDispatchTypes = ShopLoadStart …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs redux redux-thunk react-redux

13
推荐指数
1
解决办法
3万
查看次数

错误:缺少铸造所需的参数计数。请在 mintParams 中提供参数

我正在尝试使用 javascript 实现 crossmint-pay-button 。我正在使用 cdn 链接:https://unpkg.com/@crossmint/client-sdk-vanilla-ui@0.0.1-alpha.1/lib/index.global.js

<crossmint-pay-button
     collectionTitle="Gaia comic"
     collectionDescription="Gaia comic collection "
     collectionPhoto=""
     clientId="8d77450f.....ad497f612"
     mintConfig='{"type":"erc-721","price":"0.1","_count":"1"}'
     environment="staging"
/>
Run Code Online (Sandbox Code Playgroud)

当我单击下面的“付款”按钮时,会出现错误。“缺少铸造所需的参数计数。请在 mintParams 中提供参数”

在此输入图像描述

nft crossmint

-4
推荐指数
1
解决办法
358
查看次数

TypeScript 中特定类型的切换不起作用

data我试图在接口中实现常量,但为什么在 switch 情况下访问时会出错?

如果我只使用stringininterface而不是常量,APP_STATUS那么它就可以正常工作。

例子:

// Gives an error
interface InconsistenciesData {
  type: typeof APP_STATUS.INCONSISTENCIES;
  data: Inconsistency[];
}

// Works fine
interface InconsistenciesData {
  type: 'INCONSISTENCIES';
  data: Inconsistency[];
}
Run Code Online (Sandbox Code Playgroud)

下面是我的代码片段。

文件类型.ts

export const APP_STATUS = {
  CONFIRMED: 'CONFIRMED',
  INCONSISTENCIES: 'INCONSISTENCIES',
  SUCCESS: 'SUCCESS',
  ERROR: 'ERROR',
  LOADING: 'LOADING',
  OK: 'OK'
}

interface InconsistenciesLoading {
  type: typeof APP_STATUS.LOADING;
}

interface InconsistenciesError {
  type: typeof APP_STATUS.ERROR;
}

interface InconsistenciesSuccess {
  type: typeof APP_STATUS.SUCCESS;
}

interface InconsistenciesData …
Run Code Online (Sandbox Code Playgroud)

interface switch-statement typescript

-9
推荐指数
1
解决办法
721
查看次数