本文介绍了react bootstrap 预期的声明或声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将 react-bootstrap
与 Typescript 一起使用,但出现此错误.
I'm trying to use react-bootstrap
with Typescript, but I got this error.
/home/vagnerwentz/Documents/www/wecanclub/node_modules/react-bootstrap/esm/index.d.ts
TypeScript error in /home/vagnerwentz/Documents/www/wecanclub/node_modules/react-bootstrap/esm/index.d.ts(2,1):
Declaration or statement expected. TS1128
1 | export { default as Accordion } from './Accordion';
> 2 | export type { AccordionProps } from './Accordion';
| ^
3 | export { default as AccordionContext } from './AccordionContext';
4 | export { default as AccordionCollapse } from './AccordionCollapse';
5 | export type { AccordionCollapseProps } from './AccordionCollapse';
推荐答案
其实我也刚遇到这个问题.
看来你需要升级到 TS 3.8 或者将 react-bootstrap 降级到 1.0.1.检查这个已关闭的问题:
https://github.com/react-bootstrap/react-bootstrap/issues/5281
I have actually just run in to this issue as well.
It seems that you need to upgrade to TS 3.8 or downgrade react-bootstrap to 1.0.1.Check this closed issue:
https://github.com/react-bootstrap/react-bootstrap/issues/5281
这篇关于react bootstrap 预期的声明或声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!