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

Mixed callback types have trouble inferencing #3

Open
codyduong opened this issue Mar 21, 2023 · 0 comments
Open

Mixed callback types have trouble inferencing #3

codyduong opened this issue Mar 21, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@codyduong
Copy link
Owner

codyduong commented Mar 21, 2023

Describe the bug
Any mixed cascade callback types have trouble inferencing the type correctly, throwing errors on valid cascadeTo shapes.

<Cascade
  cascadeTo={[
    ['button', (c, o) => ({ ...c.buttonProps, ...o })],
    [MyCustomComponent, (c, o) => {}],
    // ^^^ Type 'FC<any>' is not assignable to type '"button"'
  ]}
  cascadeProps={{
    buttonProps: {
      onClick: onClickHandler,
    },
  }}
>
  <button />
  <div />
  <MyCustomComponent />
</Cascade>

This only occurs if cascadeTo mixes between using keyof JSX.IntrinsicElement like 'div' or 'span' with React.FCs.

Expected behavior
No error

@codyduong codyduong added the bug Something isn't working label Mar 21, 2023
@codyduong codyduong self-assigned this Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant