Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use MenuInfo #375

Open
nirvdrum opened this issue Feb 27, 2021 · 2 comments
Open

Unable to use MenuInfo #375

nirvdrum opened this issue Feb 27, 2021 · 2 comments

Comments

@nirvdrum
Copy link

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. ant-design/ant-design#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.

@webpig
Copy link

webpig commented Mar 27, 2022

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

@thawinwats
Copy link

You can access MenuInfo by using MenuProps

import type { MenuProps } from 'antd'

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

I hope this help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants