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

appBar in custom Layout does not accept AppBarProps with typescript strict:true #6019

Closed
rowr111 opened this issue Mar 9, 2021 · 1 comment · Fixed by #6035
Closed

appBar in custom Layout does not accept AppBarProps with typescript strict:true #6019

rowr111 opened this issue Mar 9, 2021 · 1 comment · Fixed by #6035

Comments

@rowr111
Copy link

rowr111 commented Mar 9, 2021

I am using Typescript (strict: true) and trying to pass a custom appbar to Layout:

const CustomLayout = (props: LayoutProps) => <Layout {...props} appBar={CustomAppBar} />;

  • it gives me an error:
  Type '(props: AppBarProps) => JSX.Element' is not assignable to type 'FunctionComponent<{ title?: string | ReactElement<any, string | JSXElementConstructor<any>> | undefined; open?: boolean

Even passing the standard react-admin AppBar component to appBar is not accepted. The error doesn't happen if I have typescript set with strict: false and then everything works, but that is not a desired solution.

Related code:
check this sandbox:
https://codesandbox.io/s/exciting-driscoll-w9fuv?file=/src/App.tsx:917-923

Environment

  • React-admin version: 3.13.2
  • Last version that did not exhibit the issue (if applicable): N/A
  • React version: 17.0.1
  • Browser: chrome
@djhi
Copy link
Collaborator

djhi commented Mar 9, 2021

Thanks for the report. We'll look into it and welcome all help on this!

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

Successfully merging a pull request may close this issue.

2 participants