@@ -91,11 +91,11 @@ interface BaseMatcher<R> {
91
91
92
92
type CustomMatcher < R = unknown > = AliasMatcher < R > & BaseMatcher < R > ;
93
93
94
- function formatCalls (
94
+ function formatCalls < Input extends object , Output extends MetadataBearer > (
95
95
context : MatcherState ,
96
- client : AwsStub < any , any , any > ,
97
- command : AwsCommandConstructur < any , any > | undefined ,
98
- expectedCall : Record < string , any > | undefined ,
96
+ client : AwsStub < Input , Output , unknown > ,
97
+ command : AwsCommandConstructur < Input , Output > | undefined ,
98
+ expectedCall : Record < string , unknown > | undefined ,
99
99
message : string ,
100
100
) : string {
101
101
const clientName = client . clientName ( ) ;
@@ -112,7 +112,6 @@ function formatCalls(
112
112
const arg = call . args [ 0 ] ;
113
113
const name = command ?. name ?? `${ clientName } with ${ arg . constructor . name } ` ;
114
114
115
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
116
115
const input = arg . input ;
117
116
118
117
return [
@@ -132,10 +131,10 @@ function formatCalls(
132
131
] . join ( '\n' ) ;
133
132
}
134
133
135
- function toHaveReceivedCommandTimes (
134
+ function toHaveReceivedCommandTimes < Input extends object , Output extends MetadataBearer > (
136
135
this : MatcherState ,
137
- client : AwsStub < any , any , any > ,
138
- command : AwsCommandConstructur < any , any > ,
136
+ client : AwsStub < Input , Output , unknown > ,
137
+ command : AwsCommandConstructur < Input , Output > ,
139
138
times : number ,
140
139
) : ExpectationResult {
141
140
const { isNot } = this ;
@@ -154,10 +153,10 @@ function toHaveReceivedCommandTimes(
154
153
} ;
155
154
const toReceiveCommandTimes = toHaveReceivedCommandTimes ;
156
155
157
- function toHaveReceivedCommandOnce (
156
+ function toHaveReceivedCommandOnce < Input extends object , Output extends MetadataBearer > (
158
157
this : MatcherState ,
159
- client : AwsStub < any , any , any > ,
160
- command : AwsCommandConstructur < any , any > ,
158
+ client : AwsStub < Input , Output , unknown > ,
159
+ command : AwsCommandConstructur < Input , Output > ,
161
160
) : ExpectationResult {
162
161
const { isNot } = this ;
163
162
const callCount = client . commandCalls ( command ) . length ;
@@ -174,10 +173,10 @@ function toHaveReceivedCommandOnce(
174
173
} ;
175
174
const toReceiveCommandOnce = toHaveReceivedCommandOnce ;
176
175
177
- function toHaveReceivedCommand (
176
+ function toHaveReceivedCommand < Input extends object , Output extends MetadataBearer > (
178
177
this : MatcherState ,
179
- client : AwsStub < any , any , any > ,
180
- command : AwsCommandConstructur < any , any > ,
178
+ client : AwsStub < Input , Output , unknown > ,
179
+ command : AwsCommandConstructur < Input , Output > ,
181
180
) : ExpectationResult {
182
181
const { isNot } = this ;
183
182
const callCount = client . commandCalls ( command ) . length ;
@@ -194,11 +193,11 @@ function toHaveReceivedCommand(
194
193
} ;
195
194
const toReceiveCommand = toHaveReceivedCommand ;
196
195
197
- function toHaveReceivedCommandWith (
196
+ function toHaveReceivedCommandWith < Input extends object , Output extends MetadataBearer > (
198
197
this : MatcherState ,
199
- client : AwsStub < any , any , any > ,
200
- command : AwsCommandConstructur < any , any > ,
201
- input : Record < string , any > ,
198
+ client : AwsStub < Input , Output , unknown > ,
199
+ command : AwsCommandConstructur < Input , Output > ,
200
+ input : Record < string , unknown > ,
202
201
) : ExpectationResult {
203
202
const { isNot, utils } = this ;
204
203
const calls = client . commandCalls ( command ) ;
@@ -219,11 +218,11 @@ function toHaveReceivedCommandWith(
219
218
} ;
220
219
const toReceiveCommandWith = toHaveReceivedCommandWith ;
221
220
222
- function toHaveReceivedCommandExactlyOnceWith (
221
+ function toHaveReceivedCommandExactlyOnceWith < Input extends object , Output extends MetadataBearer > (
223
222
this : MatcherState ,
224
- client : AwsStub < any , any , any > ,
225
- command : AwsCommandConstructur < any , any > ,
226
- input : Record < string , any > ,
223
+ client : AwsStub < Input , Output , unknown > ,
224
+ command : AwsCommandConstructur < Input , Output > ,
225
+ input : Record < string , unknown > ,
227
226
) : ExpectationResult {
228
227
const { isNot, utils } = this ;
229
228
const calls = client . commandCalls ( command ) ;
@@ -246,12 +245,12 @@ function toHaveReceivedCommandExactlyOnceWith(
246
245
} ;
247
246
const toReceiveCommandExactlyOnceWith = toHaveReceivedCommandExactlyOnceWith ;
248
247
249
- function toHaveReceivedNthCommandWith (
248
+ function toHaveReceivedNthCommandWith < Input extends object , Output extends MetadataBearer > (
250
249
this : MatcherState ,
251
- client : AwsStub < any , any , any > ,
252
- command : AwsCommandConstructur < any , any > ,
250
+ client : AwsStub < Input , Output , unknown > ,
251
+ command : AwsCommandConstructur < Input , Output > ,
253
252
times : number ,
254
- input : Record < string , any > ,
253
+ input : Record < string , unknown > ,
255
254
) : ExpectationResult {
256
255
const { isNot, utils } = this ;
257
256
const calls = client . commandCalls ( command ) ;
@@ -273,11 +272,11 @@ function toHaveReceivedNthCommandWith(
273
272
} ;
274
273
const toReceiveNthCommandWith = toHaveReceivedNthCommandWith ;
275
274
276
- function toHaveReceivedLastCommandWith (
275
+ function toHaveReceivedLastCommandWith < Input extends object , Output extends MetadataBearer > (
277
276
this : MatcherState ,
278
- client : AwsStub < any , any , any > ,
279
- command : AwsCommandConstructur < any , any > ,
280
- input : Record < string , any > ,
277
+ client : AwsStub < Input , Output , unknown > ,
278
+ command : AwsCommandConstructur < Input , Output > ,
279
+ input : Record < string , unknown > ,
281
280
) : ExpectationResult {
282
281
const { isNot, utils } = this ;
283
282
const calls = client . commandCalls ( command ) ;
@@ -301,7 +300,7 @@ const toReceiveLastCommandWith = toHaveReceivedLastCommandWith;
301
300
302
301
function toHaveReceivedAnyCommand (
303
302
this : MatcherState ,
304
- client : AwsStub < any , any , any > ,
303
+ client : AwsStub < object , MetadataBearer , unknown > ,
305
304
) {
306
305
const { isNot } = this ;
307
306
const calls = client . calls ( ) ;
0 commit comments