问题
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';
回答1:
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... please see this now closed issue... https://github.com/react-bootstrap/react-bootstrap/issues/5281
(would have put it in a comment but not allow...)
来源:https://stackoverflow.com/questions/62939139/declaration-or-statement-expected-with-react-bootstrap