diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index ca95df202b8..e00ca3308d5 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -47,7 +47,7 @@ namespace ts.InlayHints { return; } - if (isTypeNode(node)) { + if (isTypeNode(node) && !isExpressionWithTypeArguments(node)) { return; } diff --git a/tests/cases/fourslash/inlayHintsShouldWork68.ts b/tests/cases/fourslash/inlayHintsShouldWork68.ts new file mode 100644 index 00000000000..819041f4ab3 --- /dev/null +++ b/tests/cases/fourslash/inlayHintsShouldWork68.ts @@ -0,0 +1,25 @@ +/// + +////const foo = (a = 1) => class { } +//// +////const C1 = class extends foo(/*1*/1) { } +////class C2 extends foo(/*2*/1) { } + +const markers = test.markers(); + +verify.getInlayHints([ + { + text: 'a:', + position: markers[0].position, + kind: ts.InlayHintKind.Parameter, + whitespaceAfter: true + }, + { + text: 'a:', + position: markers[1].position, + kind: ts.InlayHintKind.Parameter, + whitespaceAfter: true + }, +], undefined, { + includeInlayParameterNameHints: "literals" +});