Skip to content

Commit 16cb1ea

Browse files
committed
fix(deep-keys): fix recursive types
1 parent 3e19f95 commit 16cb1ea

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import type { CollapsiblePaths } from '../src/utils/deep-keys'
2+
3+
type WithDeeplyNestedObject = {
4+
a: {
5+
b: {
6+
c: {
7+
d: {
8+
e: {
9+
f: {
10+
g: {
11+
h: {
12+
i: {
13+
j: number
14+
}
15+
}
16+
}
17+
}
18+
}
19+
}
20+
}
21+
}
22+
}
23+
}
24+
25+
type _DeeplyNestedObject = CollapsiblePaths<WithDeeplyNestedObject>
26+
27+
type WithAny = {
28+
errors?: any
29+
}
30+
31+
type _Any = CollapsiblePaths<WithAny>
32+
33+
type ArrayRecursion = { arr: Array<Array<Array<Array<[]>>>> }
34+
35+
type _ArrayRecursion = CollapsiblePaths<ArrayRecursion>
36+
37+
type WithUndefined = {
38+
status?: {
39+
valid: boolean
40+
error?: {
41+
message: string
42+
}
43+
}
44+
}
45+
46+
type _WithUndefined = CollapsiblePaths<WithUndefined>
47+
48+
type WithUnknown = {
49+
payload: unknown
50+
}
51+
52+
type _WithUnknown = CollapsiblePaths<WithUnknown>
53+
54+
type WithRealisticState = {
55+
canSubmit?: boolean
56+
isSubmitting?: boolean
57+
errors?: Array<any>
58+
errorMap?: Record<string, any>
59+
}
60+
61+
type _WithRealisticState = CollapsiblePaths<WithRealisticState>
62+
63+
type WithGeneric<TData> = {
64+
generic: TData
65+
}
66+
67+
type _WithGeneric = CollapsiblePaths<WithGeneric<{ a: { b: string } }>>

0 commit comments

Comments
 (0)