mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #7007 from RyanCavanaugh/fix7002
Add undefined checks for malformed type tags
This commit is contained in:
@@ -2613,7 +2613,7 @@ namespace ts {
|
||||
function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType {
|
||||
// First, see if this node has an @type annotation on it directly.
|
||||
const typeTag = getJSDocTypeTag(declaration);
|
||||
if (typeTag) {
|
||||
if (typeTag && typeTag.typeExpression) {
|
||||
return typeTag.typeExpression.type;
|
||||
}
|
||||
|
||||
@@ -2623,7 +2623,7 @@ namespace ts {
|
||||
|
||||
// @type annotation might have been on the variable statement, try that instead.
|
||||
const annotation = getJSDocTypeTag(declaration.parent.parent);
|
||||
if (annotation) {
|
||||
if (annotation && annotation.typeExpression) {
|
||||
return annotation.typeExpression.type;
|
||||
}
|
||||
}
|
||||
@@ -7414,7 +7414,7 @@ namespace ts {
|
||||
|
||||
function getTypeForThisExpressionFromJSDoc(node: Node) {
|
||||
const typeTag = getJSDocTypeTag(node);
|
||||
if (typeTag && typeTag.typeExpression.type.kind === SyntaxKind.JSDocFunctionType) {
|
||||
if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === SyntaxKind.JSDocFunctionType) {
|
||||
const jsDocFunctionType = <JSDocFunctionType>typeTag.typeExpression.type;
|
||||
if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === SyntaxKind.JSDocThisType) {
|
||||
return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
|
||||
|
||||
@@ -895,7 +895,8 @@ namespace Harness {
|
||||
{ name: "includeBuiltFile", type: "string" },
|
||||
{ name: "fileName", type: "string" },
|
||||
{ name: "libFiles", type: "string" },
|
||||
{ name: "noErrorTruncation", type: "boolean" }
|
||||
{ name: "noErrorTruncation", type: "boolean" },
|
||||
{ name: "suppressOutputPathCheck", type: "boolean" }
|
||||
];
|
||||
|
||||
let optionsIndex: ts.Map<ts.CommandLineOption>;
|
||||
|
||||
Reference in New Issue
Block a user