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

[v4 typescript] <MenuItemLink> seems now have missing placeholder prop #9507

Closed
smeng9 opened this issue Dec 11, 2023 · 5 comments · Fixed by #9555
Closed

[v4 typescript] <MenuItemLink> seems now have missing placeholder prop #9507

smeng9 opened this issue Dec 11, 2023 · 5 comments · Fixed by #9555
Labels

Comments

@smeng9
Copy link
Contributor

smeng9 commented Dec 11, 2023

What you were expecting:
I expect when I follow the tutorial there would be no type error https://marmelab.com/react-admin/Buttons.html#menuitemlink

What happened instead:
There is a type related error

Property 'placeholder' is missing in type '{ to: string; primaryText: string; }' but required in type 'Pick<MenuItemLinkProps, "replace" | "slot" | "style" | "title" | "children" | "role" | "action" | "about" | "security" | "primaryText" | "id" | "type" | "key" | ... 275 more ... | "tooltipProps">'.(2741)

Steps to reproduce:
Go to the example below
Run $ yarn type-check and look for errors in the src/Layout.tsx file

Related code:
https://stackblitz.com/edit/github-cubnvw?file=src%2FLayout.tsx

insert short code snippets here

Other information:

Environment

  • React-admin version: 4.16.2
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2.0
  • Browser: Safari
  • Stack trace (in case of a JS error):
@fzaninotto
Copy link
Member

Thanks for the feedback. I can't reproduce the problem locally.

Can you give more information about how you built the repro in Stackblitz?

I noticed that your stackblitz uses React 17 but "@types/react" version 18.2.43. I wonder if this may be the cause.

@panfiva
Copy link

panfiva commented Dec 12, 2023

@fzaninotto , I noticed the same issue in my project as soon as I updated "@types/react": "^18.2.42" -> "@types/react": "^18.2.43"

After I added "@types/react": "18.2.42" to resolutions in package.json, my build worked properly

@fzaninotto
Copy link
Member

So this seems to be a react types error. I invite you to open an issue in their repository.

@smeng9
Copy link
Contributor Author

smeng9 commented Jan 2, 2024

Hi @fzaninotto

Adding a backlink to the PR that causes this issue DefinitelyTyped/DefinitelyTyped#67170

Shall we consider a quick fix by omitting the placeholder prop here

export type MenuItemLinkProps = LinkProps &

@fzaninotto
Copy link
Member

@smeng9 Seems a sensible solution. Would you like to open a PR about it?

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

Successfully merging a pull request may close this issue.

3 participants