auth0/cosmos

Export all interfaces used by Cosmos components

matchai opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
When using Cosmos, I often want to extend the functionality of existing components by creating wrappers extending their functionality. Unfortunately, it's hard to enforce the same typing requirements when I'm unable to use the pre-existing interfaces.

Here's a simplified example:

import React from "react";
import { TextInput, TextInputProps, Icon } from "@auth0/cosmos";

const InputWithIcon: React.FC<TextInputProps> = (props) => (
    <div>
      <Input {...props} />
      <Icon />
    </div>
)

Unfortunately, TextInputProps is not currently exported.

Describe the solution you'd like

All interfaces used internally are exported along with the components they're used in.

Describe alternatives you've considered

React component interfaces that aren't exported can be accessed with React.ComponentProps:

type TextInputProps = React.ComponentProps<typeof TextInput>;