@@ -3,6 +3,7 @@ import type { Client } from "../client";
3
3
import { CommandIO } from "../command" ;
4
4
import type { HttpHandlerOptions } from "../http" ;
5
5
import type { MetadataBearer } from "../response" ;
6
+ import { DocumentType } from "../shapes" ;
6
7
import type { Exact } from "./exact" ;
7
8
import type { AssertiveClient , NoUndefined , UncheckedClient } from "./no-undefined" ;
8
9
@@ -13,6 +14,7 @@ type A = {
13
14
required : string | undefined ;
14
15
optional ?: string ;
15
16
nested : A ;
17
+ document : DocumentType ;
16
18
} ;
17
19
18
20
{
@@ -22,6 +24,8 @@ type A = {
22
24
const assert1 : Exact < T [ "required" ] , string > = true as const ;
23
25
const assert2 : Exact < T [ "nested" ] [ "required" ] , string > = true as const ;
24
26
const assert3 : Exact < T [ "nested" ] [ "nested" ] [ "required" ] , string > = true as const ;
27
+ const assert4 : Exact < T [ "document" ] , DocumentType > = true as const ;
28
+ const assert5 : Exact < T [ "nested" ] [ "document" ] , DocumentType > = true as const ;
25
29
}
26
30
27
31
{
@@ -30,13 +34,15 @@ type A = {
30
34
b : number | undefined ;
31
35
c : string | number | undefined ;
32
36
optional ?: string ;
37
+ document : DocumentType | undefined ;
33
38
} ;
34
39
35
40
type MyOutput = {
36
41
a ?: string ;
37
42
b ?: number ;
38
43
c ?: string | number ;
39
44
r ?: MyOutput ;
45
+ document ?: DocumentType ;
40
46
} & MetadataBearer ;
41
47
42
48
type MyConfig = {
@@ -66,17 +72,20 @@ type A = {
66
72
a : "" ,
67
73
b : 0 ,
68
74
c : 0 ,
75
+ document : { aa : "b" } ,
69
76
} ;
70
77
const get = c . getObject ( input ) ;
71
78
const output = null as unknown as Awaited < typeof get > ;
72
79
73
80
const assert1 : Exact < typeof output . a , string | undefined > = true as const ;
74
81
const assert2 : Exact < typeof output . b , number | undefined > = true as const ;
75
82
const assert3 : Exact < typeof output . c , string | number | undefined > = true as const ;
83
+ const assert4 : Exact < typeof output . document , DocumentType | undefined > = true as const ;
76
84
if ( output . r ) {
77
- const assert4 : Exact < typeof output . r . a , string | undefined > = true as const ;
78
- const assert5 : Exact < typeof output . r . b , number | undefined > = true as const ;
79
- const assert6 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
85
+ const assert5 : Exact < typeof output . r . a , string | undefined > = true as const ;
86
+ const assert6 : Exact < typeof output . r . b , number | undefined > = true as const ;
87
+ const assert7 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
88
+ const assert8 : Exact < typeof output . r . document , DocumentType | undefined > = true as const ;
80
89
}
81
90
}
82
91
@@ -88,16 +97,19 @@ type A = {
88
97
a : "" ,
89
98
b : 0 ,
90
99
c : 0 ,
100
+ document : { aa : "b" } ,
91
101
} ;
92
102
const get = c . getObject ( input ) ;
93
103
const output = null as unknown as Awaited < typeof get > ;
94
104
95
105
const assert1 : Exact < typeof output . a , string > = true as const ;
96
106
const assert2 : Exact < typeof output . b , number > = true as const ;
97
107
const assert3 : Exact < typeof output . c , string | number > = true as const ;
98
- const assert4 : Exact < typeof output . r . a , string > = true as const ;
99
- const assert5 : Exact < typeof output . r . b , number > = true as const ;
100
- const assert6 : Exact < typeof output . r . c , string | number > = true as const ;
108
+ const assert4 : Exact < typeof output . document , DocumentType > = true as const ;
109
+ const assert5 : Exact < typeof output . r . a , string > = true as const ;
110
+ const assert6 : Exact < typeof output . r . b , number > = true as const ;
111
+ const assert7 : Exact < typeof output . r . c , string | number > = true as const ;
112
+ const assert8 : Exact < typeof output . r . document , DocumentType > = true as const ;
101
113
}
102
114
103
115
{
@@ -109,10 +121,12 @@ type A = {
109
121
const assert1 : Exact < typeof output . a , string | undefined > = true as const ;
110
122
const assert2 : Exact < typeof output . b , number | undefined > = true as const ;
111
123
const assert3 : Exact < typeof output . c , string | number | undefined > = true as const ;
124
+ const assert4 : Exact < typeof output . document , DocumentType | undefined > = true as const ;
112
125
if ( output . r ) {
113
- const assert4 : Exact < typeof output . r . a , string | undefined > = true as const ;
114
- const assert5 : Exact < typeof output . r . b , number | undefined > = true as const ;
115
- const assert6 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
126
+ const assert5 : Exact < typeof output . r . a , string | undefined > = true as const ;
127
+ const assert6 : Exact < typeof output . r . b , number | undefined > = true as const ;
128
+ const assert7 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
129
+ const assert8 : Exact < typeof output . r . document , DocumentType | undefined > = true as const ;
116
130
}
117
131
}
118
132
@@ -125,10 +139,12 @@ type A = {
125
139
const assert1 : Exact < typeof output . a , string | undefined > = true as const ;
126
140
const assert2 : Exact < typeof output . b , number | undefined > = true as const ;
127
141
const assert3 : Exact < typeof output . c , string | number | undefined > = true as const ;
142
+ const assert4 : Exact < typeof output . document , DocumentType | undefined > = true as const ;
128
143
if ( output . r ) {
129
- const assert4 : Exact < typeof output . r . a , string | undefined > = true as const ;
130
- const assert5 : Exact < typeof output . r . b , number | undefined > = true as const ;
131
- const assert6 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
144
+ const assert5 : Exact < typeof output . r . a , string | undefined > = true as const ;
145
+ const assert6 : Exact < typeof output . r . b , number | undefined > = true as const ;
146
+ const assert7 : Exact < typeof output . r . c , string | number | undefined > = true as const ;
147
+ const assert8 : Exact < typeof output . r . document , DocumentType | undefined > = true as const ;
132
148
}
133
149
}
134
150
}
0 commit comments