Skip to content

Migrate component props to use interface instead of type #177

Open
@mkrause

Description

@mkrause

We make heavy use of the following pattern:

export type MyComponentProps = React.ComponentProps<'element'> & {
  extraProp: string,
};

We may want to consider migrating these to use an interface instead:

export interface MyComponentProps extends React.ComponentProps<'element'> {
  extraProp: string,
}

See this article on the reason why. The version using & is slower, especially if there are a lot of props (which there are in these HTML ComponentProps types).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions