chakra-ui-flashless icon indicating copy to clipboard operation
chakra-ui-flashless copied to clipboard

Export type definitions

Open LauraBeatris opened this issue 3 years ago • 1 comments

This PR implement changes to explicitly export type definitions.

The following error occurs when declaring an object with color variables in a separate module, instead of defining inline.

image

In order to type the object, the package should export the respective type, like so:

import { Types } from 'chakra-ui-flashless'

export const colorModeVariables: Types.Variables = { ... }

LauraBeatris avatar Feb 28 '21 18:02 LauraBeatris

Thanks for the PR @LauraBeatris! Sorry it took so long for me to have a look at this. How do you feel about just exporting the types as named exports from the package, rather than exporting them as a Types export? I don't have a lot of TS experience, but I thought I remembered seeing this convention in some other packages.

// in the module
export * from './types';

// and then later...
import { Variables } from 'chakra-ui-flashless';

export const colorModeVariables: Variables = { ... }

We could even simplify this further by just saying export type ... in the FlashlessScript.tsx file, since we're exporting everything exported by that file in index.ts. Do you see any problems with doing it this way?

trevorblades avatar Mar 13 '21 22:03 trevorblades