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

Wrong type for error prop in LayoutProps (typescript, ra-ui-materialui) #6507

Closed
NastyaLo opened this issue Aug 12, 2021 · 1 comment · Fixed by #6508
Closed

Wrong type for error prop in LayoutProps (typescript, ra-ui-materialui) #6507

NastyaLo opened this issue Aug 12, 2021 · 1 comment · Fixed by #6508
Assignees
Labels

Comments

@NastyaLo
Copy link

What you were expecting:
I expect LayoutProps['error'] error prop to have type Error | undefined

export interface LayoutProps extends CoreLayoutProps, Omit<HtmlHTMLAttributes<HTMLDivElement>, 'title'> {
    appBar?: ComponentType<AppBarProps>;
    classes?: any;
    className?: string;
    error?: ComponentType<{
        error?: Error;
        errorInfo?: React.ErrorInfo;
        title?: string | ReactElement<any>;
    }>;
    menu?: ComponentType<MenuProps>;
    notification?: ComponentType;
    sidebar?: ComponentType<{
        children: JSX.Element;
    }>;
    theme?: ThemeOptions;
}

What happened instead:


image

Related code:
As we can see from render for error, error prop has type Error | undefined | null

this.setState({ hasError: true, errorMessage, errorInfo });

image

Environment

  • React-admin version: 3.17.1
  • React version: 17.0.2
@fzaninotto
Copy link
Member

Reproduced, thanks for the report

@fzaninotto fzaninotto added the bug label Aug 13, 2021
@fzaninotto fzaninotto self-assigned this Aug 13, 2021
fzaninotto added a commit that referenced this issue Aug 13, 2021
ogustavo-pereira pushed a commit to ogustavo-pereira/react-admin that referenced this issue Nov 23, 2021
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.

2 participants