Browse Source

Handle the case that `tag.text` is a string

Sebastian Pahnke 4 years ago
parent
commit
a03a8ba908
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/languageFeatures.ts

+ 3 - 1
src/languageFeatures.ts

@@ -575,8 +575,10 @@ function tagToString(tag: ts.JSDocTagInfo): string {
 		const [paramName, ...rest] = tag.text;
 		const [paramName, ...rest] = tag.text;
 		tagLabel += `\`${paramName.text}\``;
 		tagLabel += `\`${paramName.text}\``;
 		if (rest.length > 0) tagLabel += ` — ${rest.map(r => r.text).join(' ')}`;
 		if (rest.length > 0) tagLabel += ` — ${rest.map(r => r.text).join(' ')}`;
-	} else if (tag.text) {
+	} else if (Array.isArray(tag.text)) {
 		tagLabel += ` — ${tag.text.map(r => r.text).join(' ')}`;
 		tagLabel += ` — ${tag.text.map(r => r.text).join(' ')}`;
+	} else if (tag.text) {
+		tagLabel += ` — ${tag.text}`;
 	}
 	}
 	return tagLabel;
 	return tagLabel;
 }
 }