Skip to content

Commit

Permalink
Merge pull request #292 from csandman/fix/module-augmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
csandman committed Oct 17, 2023
2 parents 3d9c4fc + 3e74e23 commit f12e5b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"sideEffects": false,
"types": "dist/types/index.d.ts",
"dependencies": {
"react-select": "5.7.0"
"react-select": "5.7.7"
},
"peerDependencies": {
"@chakra-ui/form-control": "^2.0.0",
Expand Down
14 changes: 10 additions & 4 deletions src/module-augmentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ import type {
Variant,
} from "./types";

/**
* 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}
*/
export type {} from "react-select/base";

/**
* 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/dist/declarations/src/Select" {
declare module "react-select/base" {
export interface Props<
Option,
IsMulti extends boolean,
Expand Down Expand Up @@ -197,7 +205,7 @@ declare module "react-select/dist/declarations/src/Select" {
}
}

declare module "react-select/dist/declarations/src/components/MultiValue" {
declare module "react-select" {
export interface MultiValueProps<
Option,
IsMulti extends boolean,
Expand All @@ -222,9 +230,7 @@ declare module "react-select/dist/declarations/src/components/MultiValue" {
isFocused: boolean;
sx: SystemStyleObject;
}
}

declare module "react-select/dist/declarations/src/components/indicators" {
export interface LoadingIndicatorProps<
Option,
IsMulti extends boolean,
Expand Down

0 comments on commit f12e5b3

Please sign in to comment.