react-component / react-component/menu

Unable to use MenuInfo

Open
#375 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
701
Forks
266
Avg merge
4d 11h
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the TS2709 error with import { MenuInfo } from 'rc-menu/lib/interface', then inspect the exported interface in rc-menu/lib/interface. Compare its declaration with the TypeScript version involved and verify that the import is accepted as a type without breaking existing consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.