fix(48277): show parameter type inlay hints after ? operator (#48283)

This commit is contained in:
Oleksandr T 2022-03-16 20:38:40 +02:00 committed by GitHub
parent 7f652509b6
commit f12922c8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -279,7 +279,7 @@ namespace ts.InlayHints {
continue;
}
addTypeHints(typeDisplayString, param.name.end);
addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
}
}

View File

@ -0,0 +1,23 @@
/// <reference path="fourslash.ts" />
////interface IFoo {
//// bar(x?: boolean): void;
////}
////
////const a: IFoo = {
//// bar: function (x?/**/): void {
//// throw new Error("Function not implemented.");
//// }
////}
const [marker] = test.markers();
verify.getInlayHints([
{
text: ': boolean',
position: marker.position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
], undefined, {
includeInlayFunctionParameterTypeHints: true
});