使用typescript对应用程序上的传单作出反应
我有一个react应用程序,我使用create react app工具创建,该应用程序使用typescript,在导入create react app和typescript库“@types/shallet”后,我的应用程序无法生成,错误消息如下:使用typescript对应用程序上的传单作出反应,typescript,react-leaflet,Typescript,React Leaflet,我有一个react应用程序,我使用create react app工具创建,该应用程序使用typescript,在导入create react app和typescript库“@types/shallet”后,我的应用程序无法生成,错误消息如下: Failed to compile. node_modules/@react-leaflet/core/types/index.d.ts TypeScript error in .../node_modules/@react-leaflet/core
Failed to compile.
node_modules/@react-leaflet/core/types/index.d.ts TypeScript error in .../node_modules/@react-leaflet/core/types/index.d.ts(3,1):
Declaration or statement expected. TS1128
1 | export { useAttribution } from './attribution';
2 | export { updateCircle } from './circle';
> 3 | export type { CircleMarkerProps } from './circle';
| ^
4 | export { createContainerComponent, createDivOverlayComponent, createLeafComponent, } from './component';
5 | export { CONTEXT_VERSION, LeafletContext, LeafletProvider, useLeafletContext, } from './context';
6 | export type { LeafletContextInterface } from './context';
知道如何修复吗?我将package.json中的Typescript版本从3.4.3升级到4.1.2,错误消失了。我也遇到了同样的问题,并将其发布在React传单GitHub上 正如Toni Spock所提到的,Typescript版本导致了这种情况 问题是导入/导出功能直到Typescript 3.8才可用。因此,将Typescript版本升级到最新版本应该可以解决这个问题