salt-ds icon indicating copy to clipboard operation
salt-ds copied to clipboard

Input `inputProps` errors when data attribute is provided

Open origami-z opened this issue 7 months ago • 1 comments

Area

UI Components

The problem

When passing 'data-testid' in inputProps. In satl-ds it gives TS error

TS2353: Object literal may only specify known properties, and '['data-testid']' does not exist in type 'InputHTMLAttributes<HTMLInputElement>'.

The solution

?

Whether TypeScript / React itself has types we can use

Alternatives and examples

MUI supports it by

// Accommodate arbitrary additional props coming from the `inputProps` prop
[arbitrary: string]: any;

Are you a JPMorgan Chase & Co. employee?

  • [X] I am an employee of JPMorgan Chase & Co.

origami-z avatar Jul 10 '24 16:07 origami-z