diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c975127a62f..446f426e6d3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10356,7 +10356,7 @@ namespace ts { function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type { const returnTag = getJSDocReturnTag(func); - if (returnTag) { + if (returnTag && returnTag.typeExpression) { return getTypeFromTypeNode(returnTag.typeExpression.type); } } diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo7.ts b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts new file mode 100644 index 00000000000..9faf97e7951 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts @@ -0,0 +1,19 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: file.js +//// /** +//// * This is a very cool function that is very nice. +//// * @returns something +//// */ +//// function a1() { +//// try { +//// throw new Error('x'); +//// } catch (x) { x--; } +//// return 23; +//// } +//// +//// x - /**/a1() + +goTo.marker(); +verify.quickInfoExists(); \ No newline at end of file