Skip to content

Commit a38d828

Browse files
authored
fix(Textarea): exclude isClearable from props type (DS-5291) (#432)
1 parent 718703e commit a38d828

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/components/src/components/Textarea/Textarea.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createRef } from 'react';
22

33
import { screen, render } from '@testing-library/react';
44
import { userEvent } from '@testing-library/user-event';
5-
import { describe, it, expect, vi } from 'vitest';
5+
import { describe, it, expect, expectTypeOf, vi } from 'vitest';
66

77
import { Form } from '../Form';
88

@@ -22,6 +22,10 @@ describe('Textarea', () => {
2222
const getRoot = () => screen.getByTestId('root');
2323
const getTextarea = () => screen.getByTestId('textarea');
2424

25+
it('should not expose the isClearable prop', () => {
26+
expectTypeOf<TextareaProps>().not.toHaveProperty('isClearable');
27+
});
28+
2529
it('should accept a ref', () => {
2630
const ref = createRef<HTMLTextAreaElement>();
2731
const { container } = render(<Textarea {...baseProps} ref={ref} />);

packages/components/src/components/Textarea/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export type TextareaProps = ExtendableProps<
125125
| 'style'
126126
| 'className'
127127
| 'inputElementType'
128+
| 'isClearable'
128129
>
129130
>;
130131

tools/public_api_guard/components/Textarea.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ error?: boolean;
2424
required?: boolean;
2525
hiddenLabel?: boolean;
2626
readonly?: boolean;
27-
} & Omit<TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "description" | "validationState" | "inputElementType">, "caption" | "style" | "className" | "cols" | "data-testid" | "rows" | "variant" | "slotProps" | "labelPlacement" | "labelAlign" | "fullWidth" | "isLabelHidden" | "expand"> & {
27+
} & Omit<TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "description" | "isClearable" | "validationState" | "inputElementType">, "caption" | "style" | "className" | "cols" | "data-testid" | "rows" | "variant" | "slotProps" | "labelPlacement" | "labelAlign" | "fullWidth" | "isLabelHidden" | "expand"> & {
2828
className?: string;
2929
style?: CSSProperties;
3030
variant?: TextareaPropVariant;
@@ -89,7 +89,7 @@ export type TextareaProps = ExtendableProps<{
8989
textarea?: FormFieldInputProps<'textarea'>;
9090
errorMessage?: FormFieldErrorProps;
9191
};
92-
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationState' | 'children' | 'style' | 'className' | 'inputElementType'>>;
92+
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationState' | 'children' | 'style' | 'className' | 'inputElementType' | 'isClearable'>>;
9393

9494
// Warning: (ae-forgotten-export) The symbol "FormFieldControlGroupPropVariant" needs to be exported by the entry point index.d.ts
9595
//

0 commit comments

Comments
 (0)