Skip to content

Commit 8a2f5b2

Browse files
authored
fix(45999): show parameter inlay hints before initializer (#46040)
1 parent 2667c60 commit 8a2f5b2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/services/inlayHints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ namespace ts.InlayHints {
279279
continue;
280280
}
281281

282-
addTypeHints(typeDisplayString, param.end);
282+
addTypeHints(typeDisplayString, param.name.end);
283283
}
284284
}
285285

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// type F = (a: string, b: number) => void
4+
//// const f: F = (a/*a*/, b/*b*/ = 1) => { }
5+
6+
const [a, b] = test.markers();
7+
verify.getInlayHints([
8+
{
9+
text: ': string',
10+
position: a.position,
11+
kind: ts.InlayHintKind.Type,
12+
whitespaceBefore: true
13+
},
14+
{
15+
text: ': number',
16+
position: b.position,
17+
kind: ts.InlayHintKind.Type,
18+
whitespaceBefore: true
19+
}
20+
], undefined, {
21+
includeInlayFunctionParameterTypeHints: true
22+
});

0 commit comments

Comments
 (0)