From eb2ad280bf7b2b4188f448d34e4f5d7ea0982337 Mon Sep 17 00:00:00 2001 From: Hugo Marcellin Date: Wed, 20 Nov 2024 18:51:37 +0100 Subject: [PATCH] Fix TextField adornments warnings (#637) Signed-off-by: Hugo Marcellin --- src/components/inputs/reactHookForm/text/TextInput.tsx | 2 +- .../inputs/reactHookForm/utils/TextFieldWithAdornment.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/inputs/reactHookForm/text/TextInput.tsx b/src/components/inputs/reactHookForm/text/TextInput.tsx index 593a04ae..61ccb5a6 100644 --- a/src/components/inputs/reactHookForm/text/TextInput.tsx +++ b/src/components/inputs/reactHookForm/text/TextInput.tsx @@ -113,7 +113,7 @@ export function TextInput({ {...genHelperPreviousValue(previousValue!, adornment)} {...genHelperError(error?.message)} {...formProps} - {...finalAdornment} + {...(adornment && { ...finalAdornment })} /> ); } diff --git a/src/components/inputs/reactHookForm/utils/TextFieldWithAdornment.tsx b/src/components/inputs/reactHookForm/utils/TextFieldWithAdornment.tsx index 14e6d8a6..0cb7ca7c 100644 --- a/src/components/inputs/reactHookForm/utils/TextFieldWithAdornment.tsx +++ b/src/components/inputs/reactHookForm/utils/TextFieldWithAdornment.tsx @@ -14,8 +14,8 @@ import { Input } from '../../../../utils/types/types'; export type TextFieldWithAdornmentProps = TextFieldProps & { // variant already included in TextFieldProps value: Input; // we override the default type of TextFieldProps which is unknown - adornmentPosition: string; - adornmentText: string; + adornmentPosition?: string; + adornmentText?: string; handleClearValue?: () => void; };