fix(45999): show parameter inlay hints before initializer (#46040)

This commit is contained in:
Oleksandr T
2021-09-29 19:28:23 +03:00
committed by GitHub
parent 2667c6013c
commit 8a2f5b2a6b
2 changed files with 23 additions and 1 deletions

View File

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

View File

@@ -0,0 +1,22 @@
/// <reference path="fourslash.ts" />
//// type F = (a: string, b: number) => void
//// const f: F = (a/*a*/, b/*b*/ = 1) => { }
const [a, b] = test.markers();
verify.getInlayHints([
{
text: ': string',
position: a.position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
{
text: ': number',
position: b.position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
includeInlayFunctionParameterTypeHints: true
});