@@ -58,7 +58,6 @@ declare function curry<Fn extends F.Function>(f: Fn): F.Curry<Fn>;
58
58
59
59
const __ = { } as A . x
60
60
61
- // @ts -ignore
62
61
const toCurry = ( name : string , age : number , single : boolean , nicknames ?: string ) => true
63
62
const curried = curry ( toCurry )
64
63
@@ -68,6 +67,19 @@ const test02: boolean = curried(__, 26)(__, true, __)('Jane', 'JJ') // boolean
68
67
const test03 : boolean = curried ( 'Jane' , 26 , true ) // boolean
69
68
const test04 : boolean = curried ( 'Jane' , 26 , true , 'JJ' ) // boolean
70
69
70
+ // ---------------------------------------------------------------------------------------
71
+ // EXACT
72
+
73
+ declare function exactObject < A > ( x : F . Exact < A , { a : number , b : 2 } > ) : A ;
74
+
75
+ const test07 = exactObject ( { } as { a : 1 , b : 2 } )
76
+ // @ts -expect-error
77
+ const test08 = exactObject ( { } as { a : 1 } )
78
+
79
+ checks ( [
80
+ check < typeof test07 , { a : 1 , b : 2 } , Test . Pass > ( ) ,
81
+ ] )
82
+
71
83
// ---------------------------------------------------------------------------------------
72
84
// PARAMETERS
73
85
@@ -102,9 +114,9 @@ checks([
102
114
] )
103
115
104
116
// ---------------------------------------------------------------------------------------
105
- // PATHVALID
117
+ // VALIDPATH
106
118
107
- type O_PATHVALID = {
119
+ type O_VALIDPATH = {
108
120
a : {
109
121
a : { } ;
110
122
} ;
@@ -118,10 +130,10 @@ type O_PATHVALID = {
118
130
119
131
checks ( [
120
132
check < F . ValidPath < any , [ 'a' , 'a' ] > , [ 'a' , 'a' ] , Test . Pass > ( ) ,
121
- check < F . ValidPath < O_PATHVALID , [ 'a' , 'a' ] > , [ 'a' , 'a' ] , Test . Pass > ( ) ,
122
- check < F . ValidPath < O_PATHVALID , [ 'a' , 'x' ] > , [ 'a' , 'x' ] , Test . Pass > ( ) ,
123
- check < F . ValidPath < O_PATHVALID , [ 'b' , 'a' , 'a' ] > , [ 'b' , 'a' , 'a' ] , Test . Pass > ( ) ,
124
- check < F . ValidPath < O_PATHVALID , [ 'b' , 'b' , 0 ] > , [ 'b' , 'b' , 0 ] , Test . Pass > ( ) ,
133
+ check < F . ValidPath < O_VALIDPATH , [ 'a' , 'a' ] > , [ 'a' , 'a' ] , Test . Pass > ( ) ,
134
+ check < F . ValidPath < O_VALIDPATH , [ 'a' , 'x' ] > , [ 'a' , 'x' ] , Test . Pass > ( ) ,
135
+ check < F . ValidPath < O_VALIDPATH , [ 'b' , 'a' , 'a' ] > , [ 'b' , 'a' , 'a' ] , Test . Pass > ( ) ,
136
+ check < F . ValidPath < O_VALIDPATH , [ 'b' , 'b' , 0 ] > , [ 'b' , 'b' , 0 ] , Test . Pass > ( ) ,
125
137
] )
126
138
127
139
// ---------------------------------------------------------------------------------------
@@ -132,6 +144,20 @@ checks([
132
144
check < F . Length < ( a1 : any , a2 ?: any ) => any > , 1 | 2 , Test . Pass > ( ) ,
133
145
] )
134
146
147
+ // ---------------------------------------------------------------------------------------
148
+ // NARROW
149
+
150
+ declare function narrowList < A extends any [ ] > ( x : F . Narrow < A > ) : A ;
151
+ declare function narrowObject < A extends object > ( x : F . Narrow < A > ) : A ;
152
+
153
+ const test05 = narrowList ( [ 'e' , 2 , true , { f : [ 'g' , [ 'h' ] ] } ] )
154
+ const test06 = narrowObject ( { a : 1 , b : 'c' , d : [ 'e' , 2 , true , { f : [ 'g' ] } ] } )
155
+
156
+ checks ( [
157
+ check < typeof test05 , [ 'e' , 2 , true , { f : [ 'g' , [ 'h' ] ] } ] , Test . Pass > ( ) ,
158
+ check < typeof test06 , { a : 1 , b : 'c' , d : [ 'e' , 2 , true , { f : [ 'g' ] } ] } , Test . Pass > ( ) ,
159
+ ] )
160
+
135
161
// ---------------------------------------------------------------------------------------
136
162
// PIPE
137
163
@@ -147,6 +173,12 @@ const pipedSync = pipeSync(
147
173
( message : string ) => false , // receive previous return
148
174
)
149
175
176
+ pipeSync (
177
+ curry ( ( a1 : number , d2 : number ) => `${ a1 + d2 } ` ) ,
178
+ ( b1 : string ) => [ b1 ] ,
179
+ ( c1 : string [ ] ) => [ c1 ] ,
180
+ ) ( 23 , 42 )
181
+
150
182
checks ( [
151
183
check < ( typeof pipedSync ) , ( name : string , age : number ) => boolean , Test . Pass > ( ) ,
152
184
] )
0 commit comments