Semantic-Org/Semantic-UI-React

StrictTextAreaProps has a type that includes number and undefined for the "value" field

Offen

#4.464 geöffnet am 20.02.2024

 (7 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (4.065 Forks)batch import
buggood first issue

Repository-Metriken

Stars
 (13.136 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Bug Report

Steps

<Form.TextArea onChange={(_: unknown, data: TextAreaProps) => {
  const s: string =  data.value;
}}/>

Expected Result

No TypeScript errors.

Actual Result

Type 'string | number | undefined' is not assignable to type 'string'.

Version

2.1.5

Testcase

https://codesandbox.io/p/sandbox/semantic-ui-react-forked-5tf5yh

Notes

It doesn't appear to be possible to actually set the value of the textarea to a number or undefined, so it's not clear why I'd have to cast, and it's very inconvenient to cast undefined to a String since String(undefined) is "undefined" instead of "".

Contributor Guide