Skip to content

Typing Generic forwardRefs at the Select component #1743

Description

@ankormoreankor

In PR related to the new Select component we faced a problem where the Select component must have generic props and forward ref at the same time. This led to troubles with TS types:

  • type assertions had to be added in packages/ui/src/components/form-input/index.ts and packages/ui/src/components/form-primitives/select.tsx,
  • the props type of withForm HOC was changed from ForwardRefExoticComponent<T> to ComponentType<T> | ForwardRefExoticComponent<T> in packages/ui/src/components/form-input/components/form-hoc.tsx

We need to simplify this solution.

Refs:
https://oida.dev/typescript-react-generic-forward-refs/

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions