diff --git a/src/index.ts b/src/index.ts index 475fa7f..0aeca6e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,23 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import type { SystemStyleObject } from "@chakra-ui/system"; +import type { GroupBase, StylesConfig, ThemeConfig } from "react-select"; + +/** + * This is necessary for the module `react-select/base` to be seen by TypeScript. + * Without it the module augmentation will not work properly. + * + * @see {@link https://github.com/JedWatson/react-select/pull/5762#issuecomment-1765467219} + */ +import type {} from "react-select/base"; +import type { + ChakraStylesConfig, + ColorScheme, + SelectedOptionStyle, + SizeProp, + TagVariant, + Variant, +} from "./types"; + export { default as Select } from "./select/select"; export { default as CreatableSelect } from "./select/creatable-select"; export { default as AsyncSelect } from "./select/async-select"; @@ -29,3 +49,281 @@ export { useCreatable } from "react-select/creatable"; export type { AsyncProps } from "react-select/async"; export type { CreatableProps } from "react-select/creatable"; export type { AsyncCreatableProps } from "react-select/async-creatable"; + +/** + * Module augmentation is used to add extra props to the existing interfaces + * from `react-select` as per the docs + * + * @see {@link https://react-select.com/typescript#custom-select-props} + */ +declare module "react-select/base" { + export interface Props< + Option, + IsMulti extends boolean, + Group extends GroupBase