carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Typescript : SelectProps interface is not exported

Open mamantor opened this issue 1 year ago • 2 comments

Package

@carbon/react

Browser

No response

Package version

V1.57.0

React version

V18.3.0

Description

The selectProps interface of the <Select> component is not exported.

This means that to wrap the component with third-party libs (Formik for example) we need to redeclare the interface.

Reproduction/example

Create a tsx component that wraps a <Select> component

Steps to reproduce

export function SelectField({ id, ...props }: MyFieldProps<SelectProps>) { // <- can't Access SelectProps
    return (
        <Field name={[props.name](http://props.name/)}>
            {({ field, meta }: FieldProps) => (
                <Select
                     invalidText={meta.error}
                    {...field}
                    {...props}
                />
            )}
        </Field>
    );
}

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

mamantor avatar May 22 '24 09:05 mamantor

:100:

jfroffice avatar May 22 '24 09:05 jfroffice

Out of abundance of explicitness ... please do make sure other xxxProps interfaces are exported too.

kubijo avatar Aug 28 '24 06:08 kubijo