diff --git a/components/sender/index.tsx b/components/sender/index.tsx index 9dad0069..be3faf83 100644 --- a/components/sender/index.tsx +++ b/components/sender/index.tsx @@ -145,11 +145,11 @@ function Sender(props: SenderProps, ref: React.Ref) { value, }); - const triggerValueChange = (nextValue: string, e?: React.ChangeEvent) => { + const triggerValueChange: SenderProps['onChange'] = (nextValue, event) => { setInnerValue(nextValue); if (onChange) { - onChange(nextValue, e); + onChange(nextValue, event); } }; @@ -300,10 +300,11 @@ function Sender(props: SenderProps, ref: React.Ref) { className={classnames(inputCls, contextConfig.classNames.input, classNames.input)} autoSize={{ maxRows: 8 }} value={innerValue} - onChange={(e) => { - if (e.target instanceof HTMLTextAreaElement) { - triggerValueChange(e.target.value, e as React.ChangeEvent); - } + onChange={(event) => { + triggerValueChange( + (event.target as HTMLTextAreaElement).value, + event as React.ChangeEvent, + ); triggerSpeech(true); }} onPressEnter={onInternalKeyPress}