Skip to content

Commit

Permalink
fix(usePopper): fix exported Modifier type (#1013)
Browse files Browse the repository at this point in the history
* Update yarn.loack

* Update package.json

* Update usePopper.ts

* format input by prettier

* update yarn.lock with @popperjs/core@2.11.6; allow to use undefined for the 2nd argument in Modifier
  • Loading branch information
iz-podpolja committed Sep 16, 2022
1 parent 4fcf758 commit 96b3425
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -58,7 +58,7 @@
},
"dependencies": {
"@babel/runtime": "^7.13.8",
"@popperjs/core": "^2.8.6",
"@popperjs/core": "^2.11.6",
"@restart/hooks": "^0.4.7",
"@types/warning": "^3.0.0",
"dom-helpers": "^5.2.0",
Expand Down
11 changes: 10 additions & 1 deletion src/usePopper.ts
Expand Up @@ -15,8 +15,17 @@ const initialPopperStyles = (

const disabledApplyStylesModifier = { name: 'applyStyles', enabled: false };

// In order to satisfy the current usage of options, including undefined
type OptionsWithUndefined<
T extends Popper.Obj | undefined
> = T extends Popper.Obj ? T : Popper.Obj;

// until docjs supports type exports...
export type Modifier<Name, Options> = Popper.Modifier<Name, Options>;
export type Modifier<
Name,
Options extends Popper.Obj | undefined
> = Popper.Modifier<Name, OptionsWithUndefined<Options>>;

export type Options = Popper.Options;
export type Instance = Popper.Instance;
export type Placement = Popper.Placement;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -1535,10 +1535,10 @@
dependencies:
mkdirp "^1.0.4"

"@popperjs/core@^2.8.6":
version "2.8.6"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.8.6.tgz#ad75ebe8dbecfa145af3c7e4d0ae98016458d005"
integrity sha512-1oXH2bAFXz9SttE1v/0Jp+2ZVePsPEAPGIuPKrmljWZcS3FPBEn2Q4WcANozZC0YiCjTWOF55k0g6rbSZS39ew==
"@popperjs/core@^2.11.6":
version "2.11.6"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45"
integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==

"@react-bootstrap/eslint-config@^1.3.2":
version "1.3.2"
Expand Down

0 comments on commit 96b3425

Please sign in to comment.