Skip to content

Commit bd3e9f2

Browse files
committed
Merge pull request microsoft#6709 from RyanCavanaugh/fix6662
Don't crash when return type jsdoc tag is malformed
2 parents 554ea1b + b15ff81 commit bd3e9f2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/compiler/checker.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -10380,9 +10380,11 @@ namespace ts {
1038010380

1038110381
function getReturnTypeFromJSDocComment(func: SignatureDeclaration | FunctionDeclaration): Type {
1038210382
const returnTag = getJSDocReturnTag(func);
10383-
if (returnTag) {
10383+
if (returnTag && returnTag.typeExpression) {
1038410384
return getTypeFromTypeNode(returnTag.typeExpression.type);
1038510385
}
10386+
10387+
return undefined;
1038610388
}
1038710389

1038810390
function createPromiseType(promisedType: Type): Type {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowNonTsExtensions: true
4+
// @Filename: file.js
5+
//// /**
6+
//// * This is a very cool function that is very nice.
7+
//// * @returns something
8+
//// * @param p anotherthing
9+
//// */
10+
//// function a1(p) {
11+
//// try {
12+
//// throw new Error('x');
13+
//// } catch (x) { x--; }
14+
//// return 23;
15+
//// }
16+
////
17+
//// x - /**/a1()
18+
19+
goTo.marker();
20+
verify.quickInfoExists();

0 commit comments

Comments
 (0)