react-use: Interface 'IMidiPermissionDescriptor' incorrectly extends interface 'PermissionDescriptor'

What is the current behavior? image image image image

Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:

What is the expected behavior?

A little about versions:

  • OS:
  • Browser (vendor and version):
  • React:
  • react-use:
  • Did this worked in the previous package version?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 16
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

As a workaround to this you can change your imports to direct imports:

// @deprecated author doesn't maintain react-use actively.
// use @react-hookz/web instead
import useKey from 'react-use/lib/useKey';
import useDebounce from 'react-use/lib/useDebounce';
import useClickAway from 'react-use/lib/useClickAway';
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
import useEffectOnce from 'react-use/lib/useEffectOnce';
import useWindowSize from 'react-use/lib/useWindowSize';
import usePreviousDistinct from 'react-use/lib/usePreviousDistinct';

export { useKey, useDebounce, useClickAway, useTimeoutFn, useEffectOnce, useWindowSize, usePreviousDistinct };

As long as you’re not using usePermission you can stop the build issue. You can migrate to new library as they become available or start to write your own replacements.

Hi! @react-hookz/web, the new library by one of react-use’s former maintainers (background here and here) has resolved this outstanding type issue. It might be worth taking a look.

For those interested, there’s an official migration guide for migrating from react-use to @react-hookz/web.

I’ve tested this out with TS 4.4 and this works too: https://gist.github.com/scvnathan/e9ff3a784fda80b408f514ab6f3acc68

I’m guessing these permission types are experimental so the TS team removed them