menu icon indicating copy to clipboard operation
menu copied to clipboard

Unable to use MenuInfo

Open nirvdrum opened this issue 4 years ago • 2 comments

When attempting to import MenuInfo with:

import { MenuInfo } from 'rc-menu/lib/interface'

I get an error:

Cannot use namespace 'MenuInfo' as a type.  TS2709

I think the issue is that the interface is exported without a corresponding declare modifier. I could open a PR, but I can't tell if this is really the root cause. https://github.com/ant-design/ant-design/issues/25467 indicates that the import statement should work and the history of the interface file suggests it's always been exported this way. The only other difference I could think of was a change made to TypeScript itself.

nirvdrum avatar Feb 27 '21 20:02 nirvdrum

怎么导入 MenuInfo 啊,我也遇到这个问题了。

webpig avatar Mar 27 '22 12:03 webpig

You can access MenuInfo by using MenuProps

import type { MenuProps } from 'antd'

const onClick: MenuProps['onClick'] = (e) => {
   ....
}

I hope this help

thawinwats avatar Jul 16 '22 05:07 thawinwats