Merge pull request #9042 from backstage/rugvip/tip

changesets: add tip for handling react-use error when upgrading TypeScript
This commit is contained in:
Fredrik Adelöw
2022-01-20 10:22:56 +01:00
committed by GitHub
2 changed files with 40 additions and 0 deletions
+20
View File
@@ -38,3 +38,23 @@ try {
}
}
```
Yet another issue you might run into when upgrading TypeScript is incompatibilities in the types from `react-use`. The error you would run into looks something like this:
```plain
node_modules/react-use/lib/usePermission.d.ts:1:54 - error TS2304: Cannot find name 'DevicePermissionDescriptor'.
1 declare type PermissionDesc = PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor;
```
If you encounter this error, the simplest fix is to replace full imports of `react-use` with more specific ones. For example, the following:
```ts
import { useAsync } from 'react-use';
```
Would be converted into this:
```ts
import useAsync from 'react-use/lib/useAsync';
```
+20
View File
@@ -40,3 +40,23 @@ try {
}
}
```
Yet another issue you might run into when upgrading TypeScript is incompatibilities in the types from `react-use`. The error you would run into looks something like this:
```plain
node_modules/react-use/lib/usePermission.d.ts:1:54 - error TS2304: Cannot find name 'DevicePermissionDescriptor'.
1 declare type PermissionDesc = PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor;
```
If you encounter this error, the simplest fix is to replace full imports of `react-use` with more specific ones. For example, the following:
```ts
import { useAsync } from 'react-use';
```
Would be converted into this:
```ts
import useAsync from 'react-use/lib/useAsync';
```