mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Don't crash when return type jsdoc tag is malformed
Fixes #6662 (cherry picked from commit 5a845bf0fca604a9928ec8762266231ec62fafda)
This commit is contained in:
parent
c6e18a9fcf
commit
f0e70cbf0f
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
19
tests/cases/fourslash/getJavaScriptQuickInfo7.ts
Normal file
19
tests/cases/fourslash/getJavaScriptQuickInfo7.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @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();
|
||||
Loading…
x
Reference in New Issue
Block a user