Carbon: TextInput requires 280+ properties

Created on 11 Nov 2020  路  2Comments  路  Source: carbon-design-system/carbon

What package(s) are you using?

  • [x] carbon-components
  • [x] carbon-components-react

Detailed description

Hi there! we at Hack&Craft have started using Carbon Design System with React and found this weird issue with TextInput where the field requires 280+ properties to be required.

I assume there's an error since it doesn't sound right to require so many properties for an input field.

Type '{ value: string; }' is missing the following properties from type 'Pick<PropsWithChildren<TextInputProps>, "form" | "slot" | "style" | "title" | "pattern" | "children" | "type" | "defaultChecked" | "defaultValue" | ... 281 more ... | "invalidText">': id, labelText

Versions

  • carbon-components: 10.22.0
  • carbon-components-react: 7.22.0
  • typescript: 3.7.5

Code to reproduce:

import { TextInput } from 'carbon-components-react';

export function Test() {
  return <TextInput value="test" />
}

Screenshot

Screenshot 2020-11-11 at 17 15 56

waiting for author's response 馃挰 bug 馃悰

All 2 comments

Hey there @matias-quezada! That does seem odd... Seems like this is an issue with the defined types for typescript. We don't maintain the typings so I'm wondering if an update needs to be made on that end? https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/carbon-components-react

Thanks for your time, I'll contact DefinitelyTyped team to see what can we do with this 馃憤

Was this page helpful?
0 / 5 - 0 ratings