Skip to content

Commit 810d2d4

Browse files
committed
perf(types): avoid computing PathImpl2<T> twice
1 parent f146d43 commit 810d2d4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/types/path-value.type.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ export type PathImpl<T, Key extends keyof T> = Key extends string
2222
export type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
2323

2424
export type Path<T> = keyof T extends string
25-
? PathImpl2<T> extends string | keyof T
26-
? PathImpl2<T>
25+
? PathImpl2<T> extends infer P
26+
? P extends string | keyof T
27+
? P
28+
: keyof T
2729
: keyof T
2830
: never;
2931

0 commit comments

Comments
 (0)