Skip to content

Commit f12922c

Browse files
authored
fix(48277): show parameter type inlay hints after ? operator (microsoft#48283)
1 parent 7f65250 commit f12922c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-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.name.end);
282+
addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
283283
}
284284
}
285285

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////interface IFoo {
4+
//// bar(x?: boolean): void;
5+
////}
6+
////
7+
////const a: IFoo = {
8+
//// bar: function (x?/**/): void {
9+
//// throw new Error("Function not implemented.");
10+
//// }
11+
////}
12+
13+
const [marker] = test.markers();
14+
verify.getInlayHints([
15+
{
16+
text: ': boolean',
17+
position: marker.position,
18+
kind: ts.InlayHintKind.Type,
19+
whitespaceBefore: true
20+
},
21+
], undefined, {
22+
includeInlayFunctionParameterTypeHints: true
23+
});

0 commit comments

Comments
 (0)