From ba3fc3d26ca798c84325ea0db3cf9e52e60e7311 Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:18:29 -0500 Subject: [PATCH 1/5] Initial typescript fixes --- src/components/TextInput/TextInput.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index a70d4f0a..db3b721b 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames'; -import type { Ref } from 'react'; +import type { ComponentPropsWithoutRef, Ref } from 'react'; import { forwardRef, type ReactNode } from 'react'; import type { TextInputStatusType } from './TextInputStatus'; import { getTextInputStatusClass } from './TextInputStatus'; @@ -20,7 +20,7 @@ interface RequiredTextInputProperties { name: string; } -interface CustomTextInputProperties { +interface CustomTextInputProperties extends ComponentPropsWithoutRef<'input'> { className?: string; inputProps?: JSX.IntrinsicElements['input']; inputRef?: TextInputReference; @@ -30,16 +30,15 @@ interface CustomTextInputProperties { isFullWidth?: boolean; } -export type OptionalTextInputProperties = CustomTextInputProperties & - JSX.IntrinsicElements['input']; +// export type OptionalTextInputProperties = CustomTextInputProperties & JSX.IntrinsicElements['input']; +export type OptionalTextInputProperties = CustomTextInputProperties; -export type TextInputProperties = OptionalTextInputProperties & - RequiredTextInputProperties; +export type TextInputProperties = OptionalTextInputProperties & RequiredTextInputProperties; /** * Source: https://cfpb.github.io/design-system/components/text-inputs */ -export const TextInput = forwardRef( +export const TextInput = forwardRef( ( { className, @@ -49,10 +48,11 @@ export const TextInput = forwardRef( name, status = 'info', type = 'text', + maxLength, isFullWidth = false, ...otherInputProperties - }: JSX.IntrinsicElements['input'] & TextInputProperties, - reference: Ref + }, + reference ) => { const classes = [ 'a-text-input', From 2085019324df6f1313d3f4cbb9992b65350f2d9a Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:25:33 -0500 Subject: [PATCH 2/5] prettier --- src/components/TextInput/TextInput.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index db3b721b..c2965a04 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -33,7 +33,8 @@ interface CustomTextInputProperties extends ComponentPropsWithoutRef<'input'> { // export type OptionalTextInputProperties = CustomTextInputProperties & JSX.IntrinsicElements['input']; export type OptionalTextInputProperties = CustomTextInputProperties; -export type TextInputProperties = OptionalTextInputProperties & RequiredTextInputProperties; +export type TextInputProperties = OptionalTextInputProperties & + RequiredTextInputProperties; /** * Source: https://cfpb.github.io/design-system/components/text-inputs From b331e2aa2fa2a6d9a596f6814c01bba6a2eb5e15 Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:31:30 -0500 Subject: [PATCH 3/5] removed useless comment --- src/components/TextInput/TextInput.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index c2965a04..da6e1027 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -30,7 +30,6 @@ interface CustomTextInputProperties extends ComponentPropsWithoutRef<'input'> { isFullWidth?: boolean; } -// export type OptionalTextInputProperties = CustomTextInputProperties & JSX.IntrinsicElements['input']; export type OptionalTextInputProperties = CustomTextInputProperties; export type TextInputProperties = OptionalTextInputProperties & From a4942bec50d4b3fd2dd4eaf1630a3aedb84bffae Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:38:43 -0500 Subject: [PATCH 4/5] Removed unused import --- src/components/TextInput/TextInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index da6e1027..05a21c48 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -1,5 +1,5 @@ import classnames from 'classnames'; -import type { ComponentPropsWithoutRef, Ref } from 'react'; +import type { ComponentPropsWithoutRef } from 'react'; import { forwardRef, type ReactNode } from 'react'; import type { TextInputStatusType } from './TextInputStatus'; import { getTextInputStatusClass } from './TextInputStatus'; From 163d7e19b2642bed7bf14d056a73f7cd31c57101 Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:45:09 -0500 Subject: [PATCH 5/5] removing property included in error. --- src/components/TextInput/TextInput.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/TextInput/TextInput.tsx b/src/components/TextInput/TextInput.tsx index 05a21c48..d5f2d2b9 100644 --- a/src/components/TextInput/TextInput.tsx +++ b/src/components/TextInput/TextInput.tsx @@ -48,7 +48,6 @@ export const TextInput = forwardRef( name, status = 'info', type = 'text', - maxLength, isFullWidth = false, ...otherInputProperties },