Skip to content

Commit 162a197

Browse files
committed
fix ts types
# Conflicts: # packages/react-docgen/src/utils/flowUtilityTypes.ts
1 parent 4fd750a commit 162a197

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packages/react-docgen/src/utils/flowUtilityTypes.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ export function isSupportedUtilityType(
2727
* $ReadOnly<T> => T
2828
*/
2929
export function unwrapUtilityType(path: NodePath): NodePath {
30-
while (isSupportedUtilityType(path)) {
31-
const typeParameters = path.get('typeParameters');
32-
30+
let resultPath: NodePath = path;
31+
while (isSupportedUtilityType(resultPath)) {
32+
const typeParameters = resultPath.get('typeParameters');
3333
if (!typeParameters.hasNode()) break;
3434

35-
const param = typeParameters.get('params')[0];
36-
37-
if (!param) break;
35+
const firstParam = typeParameters.get('params')[0];
36+
if (!firstParam) break;
3837

39-
path = param;
38+
resultPath = firstParam;
4039
}
4140

42-
return path;
41+
return resultPath;
4342
}

0 commit comments

Comments
 (0)