Skip to content

I have TypeScript Issue when using the Use custom component #5

@Ofer-Gal

Description

@Ofer-Gal

const options = { render: (message, onConfirm, onCancel) => { return ( <> <h2> "Are you sure? </h2> <p>{message}</p> <PrimaryButton onClick={onConfirm} text="Yes" style={{ marginRight: '10px' }} /> <DefaultButton onClick={onCancel} text="No" style={{ marginLeft: '10px' }} /> </> ); } };

then the statement:
const result = await confirm(message, options);
Shows error:

TS2345: Argument of type '{ render: (message: any, onConfirm: any, onCancel: any) => Element; }' is not assignable to parameter of type 'Options'.
  The types returned by 'render(...)' are incompatible between these types.
    Type 'Element' is missing the following properties from type 'Element': attributes, classList, className, clientHeight, and 123 more.

How can I fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions