![](/img/trans.png)
[英]Cannot find module './App.svelte' or its corresponding type declarations
[英]Cannot find module 'graphql-hooks' or its corresponding type declarations
如何在 react-native TypeScript 中安裝 graphql-hooks? 如何定義類型?
我已經使用 npm 安裝了,但這不起作用。
React native(包括 TypeScript)不應該與任何其他項目有任何不同:
npm install graphql-hooks
也許您的項目正在使用yarn
?
yarn add graphql-hooks
當我在標准的 create-react-app 中嘗試時,它可以工作並立即獲得 TypeScript 類型。
我認為 graphql-hooks 帶有類型。 但是,一個小技巧是創建您自己的自定義類型。 IE
創建一個index.d.ts
文件並插入以下代碼
declare module 'graphql-hooks' {
const noTypesYet: any;
export default noTypesYet;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.