diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cffd5acc456..82b2880ba14 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31508,6 +31508,9 @@ namespace ts { } function getParameterIdentifierNameAtPosition(signature: Signature, pos: number): [parameterName: __String, isRestParameter: boolean] | undefined { + if (signature.declaration?.kind === SyntaxKind.JSDocFunctionType) { + return undefined; + } const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); if (pos < paramCount) { const param = signature.parameters[pos]; diff --git a/tests/cases/fourslash/inlayHintsCrash1.ts b/tests/cases/fourslash/inlayHintsCrash1.ts new file mode 100644 index 00000000000..793bac5eff2 --- /dev/null +++ b/tests/cases/fourslash/inlayHintsCrash1.ts @@ -0,0 +1,14 @@ +/// +// @allowJs: true +// @checkJs: true +// @Filename: foo.js +//// /** +//// * @param {function(string): boolean} f +//// */ +//// function doThing(f) { +//// f(100) +//// } +verify.getInlayHints([], undefined, { + includeInlayVariableTypeHints: true, + includeInlayParameterNameHints: "all", +});