Skip to content

Commit 3b5689f

Browse files
committed
Add more test coverage for unusedParameterInLambda
1 parent e354754 commit 3b5689f

4 files changed

Lines changed: 44 additions & 2 deletions

File tree

tests/cases/fourslash/unusedParameterInLambda1.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// @noUnusedLocals: true
44
// @noUnusedParameters: true
55
//// function f1() {
6-
//// [|return (x:number) => {}|]
6+
//// [|return /*~a*/(/*~b*/x/*~c*/:/*~d*/number/*~e*/)/*~f*/ => /*~g*/{/*~h*/}/*~i*/|]
77
//// }
88

9+
// In a perfect world, /*~f*/ and /*~h*/ would probably be retained.
910
verify.codeFix({
1011
description: "Remove declaration for: 'x'",
1112
index: 0,
12-
newRangeContent: "return () => {}",
13+
newRangeContent: "return /*~a*/() => /*~g*/ { }/*~i*/",
1314
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @noUnusedLocals: true
4+
// @noUnusedParameters: true
5+
//// function f1() {
6+
//// [|return /*~a*/x/*~b*/ /*~c*/=>/*~d*/ {/*~e*/}/*~f*/|]
7+
//// }
8+
9+
// In a perfect world, /*~c*/ and /*~e*/ would probably be retained.
10+
verify.codeFix({
11+
description: "Remove declaration for: 'x'",
12+
index: 0,
13+
newRangeContent: "return /*~a*/() => /*~d*/ { }/*~f*/",
14+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @noUnusedLocals: true
4+
// @noUnusedParameters: true
5+
//// function f1() {
6+
//// [|return /*~a*/(/*~b*/x/*~c*/,/*~d*/y/*~e*/)/*~f*/ => /*~g*/x/*~h*/|]
7+
//// }
8+
9+
// In a perfect world, /*~c*/ would probably be retained, rather than /*~e*/.
10+
verify.codeFix({
11+
description: "Remove declaration for: 'y'",
12+
index: 0,
13+
newRangeContent: "return /*~a*/(/*~b*/x/*~e*/)/*~f*/ => /*~g*/x/*~h*/",
14+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @noUnusedLocals: true
4+
// @noUnusedParameters: true
5+
//// function f1() {
6+
//// [|return /*~a*/(/*~b*/x/*~c*/,/*~d*/y/*~e*/)/*~f*/ => /*~g*/y/*~h*/|]
7+
//// }
8+
9+
verify.codeFix({
10+
description: "Remove declaration for: 'x'",
11+
index: 0,
12+
newRangeContent: "return /*~a*/(/*~d*/y/*~e*/)/*~f*/ => /*~g*/y/*~h*/",
13+
});

0 commit comments

Comments
 (0)