Typescript 4.4.2 breaks react-use
See original GitHub issueVersion 4.4.2 of Typescript released on August 27th 2021 breaks react-use with:
node_modules/react-use/lib/usePermission.d.ts:1:54 - error TS2304: Cannot find name 'DevicePermissionDescriptor'.
1 declare type PermissionDesc = PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/react-use/lib/usePermission.d.ts:1:83 - error TS2304: Cannot find name 'MidiPermissionDescriptor'.
1 declare type PermissionDesc = PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/react-use/lib/usePermission.d.ts:1:110 - error TS2304: Cannot find name 'PushPermissionDescriptor'.
1 declare type PermissionDesc = PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor;
~~~~~~~~~~~~~~~~~~~~~~~~
All three:
- DevicePermissionDescriptor
- MidiPermissionDescriptor
- PushPermissionDescriptor
seem to have moved to the [webworker lib]:(https://github.com/microsoft/TypeScript/blob/cec2fda9a53620dc545a2c4d7b0156446ab145b4/lib/lib.webworker.d.ts#L147)
The effect is that the build will break for anyone who uses react-use
and runs yarn
with a “Compatible with” typescript package of ^4.0.0:
"typescript": "^4.0.0"
For now fixing typescript on 4.3.5
solves this.
Should the usePermissions
hook be updated or should a lib definition be added to the tsconfig.json
? I’m not sure.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Documentation - TypeScript 4.4
TypeScript lets us describe objects where every property has to have a certain type using index signatures. This allows us to use these...
Read more >TypeScript 4.4: The Good, The Bad and The Not So Bad
We'll start by summarising the breaking changes. In this release, there are a few of them that aren't major but could still break...
Read more >Announcing TypeScript 4.4 - Microsoft Developer Blogs
Breaking Changes · lib.d.ts Changes for TypeScript 4.4 · More-Compliant Indirect Calls for Imported Functions · Using unknown in Catch Variables.
Read more >NPM package cannot be used as a JSX Component
3", "@types/react": "^17.0.44", "typescript": "^4.3.5" "@types/node": "^ ...
Read more >tss-react - npm
Type safe CSS-in-JS API heavily inspired by react-jss. Latest version: 4.4.2, last published: a day ago. Start using tss-react in your project by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
still seeing this too with
17.3.2
andts@4.5.4
andvite@2.8.0
Workaround (if NOT using
usePermissions
) is to import directlyAnd yes, this should be re-opened since it’s still an issue.