We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fd750a commit 162a197Copy full SHA for 162a197
1 file changed
packages/react-docgen/src/utils/flowUtilityTypes.ts
@@ -27,17 +27,16 @@ export function isSupportedUtilityType(
27
* $ReadOnly<T> => T
28
*/
29
export function unwrapUtilityType(path: NodePath): NodePath {
30
- while (isSupportedUtilityType(path)) {
31
- const typeParameters = path.get('typeParameters');
32
-
+ let resultPath: NodePath = path;
+ while (isSupportedUtilityType(resultPath)) {
+ const typeParameters = resultPath.get('typeParameters');
33
if (!typeParameters.hasNode()) break;
34
35
- const param = typeParameters.get('params')[0];
36
37
- if (!param) break;
+ const firstParam = typeParameters.get('params')[0];
+ if (!firstParam) break;
38
39
- path = param;
+ resultPath = firstParam;
40
}
41
42
- return path;
+ return resultPath;
43
0 commit comments