Skip to content

Incorrect types for IconButton #2519

@colebemis

Description

@colebemis

Description

IconButton incorrectly allows a leadingIcon prop to be passed to the component.

// IconButton doesn't accept a `leadingIcon` prop.
// This should cause a TypeScript error but it doesn't.
// Instead, it causes a runtime error.
<IconButton leadingIcon={PencilIcon} />

Orginally reported by @milemons in this Slack thread

Steps to reproduce

See this StackBlitz for a reproduction of the bug: https://stackblitz.com/edit/react-ts-nyunix?file=App.tsx

Version

v35.14.0

Browser

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions