@@ -95,6 +95,26 @@ ruleTester({ types: true }).run('no-implicit-any-catch', noImplicitAnyCatchRule,
95
95
);
96
96
` ,
97
97
} ,
98
+ {
99
+ code : stripIndent `
100
+ // arrow; explicit unknown and caught; default option
101
+ import { throwError, catchError, Observable } from "rxjs";
102
+
103
+ throwError(new Error("Kaboom!")).pipe(
104
+ catchError((error: unknown, caught: Observable<unknown>) => console.error(error)),
105
+ );
106
+ ` ,
107
+ } ,
108
+ {
109
+ code : stripIndent `
110
+ // non-arrow; explicit unknown and caught; default option
111
+ import { throwError, catchError, Observable } from "rxjs";
112
+
113
+ throwError(new Error("Kaboom!")).pipe(
114
+ catchError(function (error: unknown, caught: Observable<unknown>) { console.error(error); }),
115
+ );
116
+ ` ,
117
+ } ,
98
118
{
99
119
code : stripIndent `
100
120
// subscribe; arrow; explicit unknown; default option
@@ -117,6 +137,28 @@ ruleTester({ types: true }).run('no-implicit-any-catch', noImplicitAnyCatchRule,
117
137
);
118
138
` ,
119
139
} ,
140
+ {
141
+ code : stripIndent `
142
+ // subscribe; arrow; explicit unknown and caught; default option
143
+ import { throwError, catchError, Observable } from "rxjs";
144
+
145
+ throwError(new Error("Kaboom!")).subscribe(
146
+ undefined,
147
+ (error: unknown, caught: Observable<unknown>) => console.error(error)
148
+ );
149
+ ` ,
150
+ } ,
151
+ {
152
+ code : stripIndent `
153
+ // subscribe; arrow; explicit any and caught; default option
154
+ import { throwError, catchError, Observable } from "rxjs";
155
+
156
+ throwError(new Error("Kaboom!")).subscribe(
157
+ undefined,
158
+ (error: any, caught: Observable<unknown>) => console.error(error)
159
+ );
160
+ ` ,
161
+ } ,
120
162
{
121
163
code : stripIndent `
122
164
// subscribe observer; arrow; explicit unknown; default option
@@ -137,6 +179,26 @@ ruleTester({ types: true }).run('no-implicit-any-catch', noImplicitAnyCatchRule,
137
179
});
138
180
` ,
139
181
} ,
182
+ {
183
+ code : stripIndent `
184
+ // subscribe observer; arrow; explicit unknown and caught; default option
185
+ import { throwError, catchError, Observable } from "rxjs";
186
+
187
+ throwError(new Error("Kaboom!")).subscribe({
188
+ error: (error: unknown, caught: Observable<unknown>) => console.error(error)
189
+ });
190
+ ` ,
191
+ } ,
192
+ {
193
+ code : stripIndent `
194
+ // subscribe observer; arrow; explicit any and caught; default option
195
+ import { throwError, catchError, Observable } from "rxjs";
196
+
197
+ throwError(new Error("Kaboom!")).subscribe({
198
+ error: (error: any, caught: Observable<unknown>) => console.error(error)
199
+ });
200
+ ` ,
201
+ } ,
140
202
{
141
203
code : stripIndent `
142
204
// tap; arrow; explicit unknown; default option
@@ -272,6 +334,40 @@ ruleTester({ types: true }).run('no-implicit-any-catch', noImplicitAnyCatchRule,
272
334
] ,
273
335
} ,
274
336
) ,
337
+ fromFixture (
338
+ stripIndent `
339
+ // arrow; implicit any and caught
340
+ import { throwError, catchError } from "rxjs";
341
+
342
+ throwError(new Error("Kaboom!")).pipe(
343
+ catchError((error, caught) => console.error(error)),
344
+ ~~~~~ [implicitAny suggest]
345
+ );
346
+ ` ,
347
+ {
348
+ output : stripIndent `
349
+ // arrow; implicit any and caught
350
+ import { throwError, catchError } from "rxjs";
351
+
352
+ throwError(new Error("Kaboom!")).pipe(
353
+ catchError((error: unknown, caught) => console.error(error)),
354
+ );
355
+ ` ,
356
+ suggestions : [
357
+ {
358
+ messageId : 'suggestExplicitUnknown' ,
359
+ output : stripIndent `
360
+ // arrow; implicit any and caught
361
+ import { throwError, catchError } from "rxjs";
362
+
363
+ throwError(new Error("Kaboom!")).pipe(
364
+ catchError((error: unknown, caught) => console.error(error)),
365
+ );
366
+ ` ,
367
+ } ,
368
+ ] ,
369
+ } ,
370
+ ) ,
275
371
fromFixture (
276
372
stripIndent `
277
373
// non-arrow; implicit any
@@ -309,6 +405,40 @@ ruleTester({ types: true }).run('no-implicit-any-catch', noImplicitAnyCatchRule,
309
405
] ,
310
406
} ,
311
407
) ,
408
+ fromFixture (
409
+ stripIndent `
410
+ // non-arrow; implicit any and caught
411
+ import { throwError, catchError } from "rxjs";
412
+
413
+ throwError(new Error("Kaboom!")).pipe(
414
+ catchError(function (error, caught) { console.error(error); })
415
+ ~~~~~ [implicitAny suggest]
416
+ );
417
+ ` ,
418
+ {
419
+ output : stripIndent `
420
+ // non-arrow; implicit any and caught
421
+ import { throwError, catchError } from "rxjs";
422
+
423
+ throwError(new Error("Kaboom!")).pipe(
424
+ catchError(function (error: unknown, caught) { console.error(error); })
425
+ );
426
+ ` ,
427
+ suggestions : [
428
+ {
429
+ messageId : 'suggestExplicitUnknown' ,
430
+ output : stripIndent `
431
+ // non-arrow; implicit any and caught
432
+ import { throwError, catchError } from "rxjs";
433
+
434
+ throwError(new Error("Kaboom!")).pipe(
435
+ catchError(function (error: unknown, caught) { console.error(error); })
436
+ );
437
+ ` ,
438
+ } ,
439
+ ] ,
440
+ } ,
441
+ ) ,
312
442
fromFixture (
313
443
stripIndent `
314
444
// arrow; explicit any; explicit option
0 commit comments