javascript - 尝试在 React 中导入导出的接口,但 React 找不到
问题描述
我在同一个目录中有两个文件:CosmWasmContext.js 和 CosmWasmHooks.js。
这是在我的 CosmWasmHooks.js 文件中:
export interface ISigningCosmWasmClientContext {
...
}
export const useSigningCosmWasmClient = (): ISigningCosmWasmClientContext => {
...
}
我想在我的 CosmWasmContext.js 文件中同时使用接口和函数。我只能导入函数 useSigningCosmWasmClient,但不能导入接口。
这些是我尝试从 CosmWasmHooks 导入的方式:
import { useSigningCosmWasmClient,ISigningCosmWasmClientContext } from './CosmWasmHooks'
import { useSigningCosmWasmClient} from './CosmWasmHooks'
import { ISigningCosmWasmClientContext } from './CosmWasmHooks'
import { useSigningCosmWasmClient} from './CosmWasmHooks'
import ISigningCosmWasmClientContext from './CosmWasmHooks'
useSigningCosmWasmClient
我可以毫无问题地导入和使用。唯一的问题是ISigningCosmWasmClientContext
界面。
有谁知道为什么我在导入时可能会遇到如此奇怪的问题?我以前从未遇到过这个问题。
解决方案
推荐阅读
- bootstrap-4 - 如何使用 Sass 生成 Bootstrap 样式
- python - 在 Python 中的 News API 中附加新闻和日期
- arrays - 如何从MongoDB中的所有子数组中删除元素
- c# - XUnit 服务层测试核心 3 System.ArgumentNullException
- tiff - 使用 gdal 命令更改 .tif 文件的 CRS
- r - 向量化的 Mutate_at 和 ifelse 问题
- java - Quarkus Reactive Postgresql 多个查询
- typescript - 错误代码 16 和错误代码 14,带有调度云功能
- javascript - 使用 EJS 和 Node 动态渲染具有函数的 HTML div
- typescript - 如何在 TypeScript 的类原型中实现迭代器?