diff --git a/lib/enu/diagnosticMessages.generated.json.lcg b/lib/enu/diagnosticMessages.generated.json.lcg
index 39be2d5b40484..ccb8667c05396 100644
--- a/lib/enu/diagnosticMessages.generated.json.lcg
+++ b/lib/enu/diagnosticMessages.generated.json.lcg
@@ -3339,6 +3339,12 @@
+ -
+
+
+
+
+
-
diff --git a/lib/tsc.js b/lib/tsc.js
index d567e1bf2bd65..18c01ba97d276 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -60,7 +60,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.1";
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
@@ -3495,6 +3495,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -21970,6 +21971,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -25719,7 +25721,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -26423,7 +26425,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -28196,6 +28198,8 @@ var ts;
return !!target.resolvedReturnType;
case 4:
return !!target.immediateBaseConstraint;
+ case 6:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -31266,11 +31270,20 @@ var ts;
return getTypeOfSymbol(symbol);
}
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -40665,12 +40678,16 @@ var ts;
return result;
}
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
if (ts.getJSDocClassTag(node))
return true;
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -40703,7 +40720,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 9cff045e58a83..3dbcde2744c61 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -88,7 +88,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -5453,6 +5453,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -27086,6 +27087,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -30776,6 +30778,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
@@ -31535,7 +31538,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -32338,7 +32341,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -34285,6 +34288,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
+ case 6 /* JSDocTypeReference */:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -37777,7 +37782,7 @@ var ts;
if (type) {
return type;
}
- // JS are 'string' or 'number', not an enum type.
+ // JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
@@ -37815,12 +37820,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37945,7 +37959,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
- // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
+ // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
@@ -48904,14 +48918,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -48944,7 +48962,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index 6bb63f0547dbe..5f76efa206a84 100644
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -84,7 +84,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -5449,6 +5449,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -27082,6 +27083,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -30772,6 +30774,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
@@ -31531,7 +31534,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -32334,7 +32337,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -34281,6 +34284,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
+ case 6 /* JSDocTypeReference */:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -37773,7 +37778,7 @@ var ts;
if (type) {
return type;
}
- // JS are 'string' or 'number', not an enum type.
+ // JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
@@ -37811,12 +37816,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37941,7 +37955,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
- // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
+ // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
@@ -48900,14 +48914,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -48940,7 +48958,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
diff --git a/lib/typescript.js b/lib/typescript.js
index 93f550425a96b..8d2a68197cfa7 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -75,7 +75,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -5440,6 +5440,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -27073,6 +27074,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -30763,6 +30765,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
@@ -31522,7 +31525,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -32325,7 +32328,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -34272,6 +34275,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
+ case 6 /* JSDocTypeReference */:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -37764,7 +37769,7 @@ var ts;
if (type) {
return type;
}
- // JS are 'string' or 'number', not an enum type.
+ // JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
@@ -37802,12 +37807,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37932,7 +37946,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
- // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
+ // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
@@ -48891,14 +48905,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -48931,7 +48949,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index 93f550425a96b..8d2a68197cfa7 100644
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -75,7 +75,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -5440,6 +5440,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -27073,6 +27074,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -30763,6 +30765,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
@@ -31522,7 +31525,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -32325,7 +32328,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -34272,6 +34275,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
+ case 6 /* JSDocTypeReference */:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -37764,7 +37769,7 @@ var ts;
if (type) {
return type;
}
- // JS are 'string' or 'number', not an enum type.
+ // JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
@@ -37802,12 +37807,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37932,7 +37946,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
- // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
+ // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
@@ -48891,14 +48905,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -48931,7 +48949,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index bef6ff92551e9..9cbfd80751695 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -88,7 +88,7 @@ var ts;
// If changing the text in this section, be sure to test `configureNightly` too.
ts.versionMajorMinor = "3.1";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".1";
+ ts.version = ts.versionMajorMinor + ".2";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -5453,6 +5453,7 @@ var ts;
Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom: diag(2584, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2584", "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'."),
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later: diag(2585, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_2585", "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later."),
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
+ JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -27086,6 +27087,7 @@ var ts;
function bindChildrenWorker(node) {
if (checkUnreachable(node)) {
bindEachChild(node);
+ bindJSDoc(node);
return;
}
switch (node.kind) {
@@ -30776,6 +30778,7 @@ var ts;
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
+ TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
var CheckMode;
(function (CheckMode) {
@@ -31535,7 +31538,7 @@ var ts;
if (!result) {
if (lastLocation) {
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
- if (lastLocation.commonJsModuleIndicator && name === "exports") {
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
}
@@ -32338,7 +32341,7 @@ var ts;
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
}
function getCommonJsExportEquals(exported, moduleSymbol) {
- if (!exported || moduleSymbol.exports.size === 1) {
+ if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
return exported;
}
var merged = cloneSymbol(exported);
@@ -34285,6 +34288,8 @@ var ts;
return !!target.resolvedReturnType;
case 4 /* ImmediateBaseConstraint */:
return !!target.immediateBaseConstraint;
+ case 6 /* JSDocTypeReference */:
+ return !!getSymbolLinks(target).resolvedJSDocType;
}
return ts.Debug.assertNever(propertyName);
}
@@ -37777,7 +37782,7 @@ var ts;
if (type) {
return type;
}
- // JS are 'string' or 'number', not an enum type.
+ // JS enums are 'string' or 'number', not an enum type.
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
var links = getNodeLinks(enumTag);
@@ -37815,12 +37820,21 @@ var ts;
* the type of this reference is just the type of the value we resolved to.
*/
function getJSDocTypeReference(node, symbol, typeArguments) {
+ if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
+ return errorType;
+ }
var assignedType = getAssignedClassType(symbol);
var valueType = getTypeOfSymbol(symbol);
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
+ if (!popTypeResolution()) {
+ getSymbolLinks(symbol).resolvedJSDocType = errorType;
+ error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
+ return errorType;
+ }
if (referenceType || assignedType) {
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
- return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
+ return getSymbolLinks(symbol).resolvedJSDocType = type;
}
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37945,7 +37959,7 @@ var ts;
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
type = getTypeReferenceType(node, symbol);
}
- // Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
+ // Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
// type reference in checkTypeReferenceNode.
links.resolvedSymbol = symbol;
links.resolvedType = type;
@@ -48904,14 +48918,18 @@ var ts;
* file.
*/
function isJSConstructor(node) {
- if (node && ts.isInJSFile(node)) {
+ if (!node || !ts.isInJSFile(node)) {
+ return false;
+ }
+ var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
+ ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
+ undefined;
+ if (func) {
// If the node has a @class tag, treat it like a constructor.
if (ts.getJSDocClassTag(node))
return true;
// If the symbol of the node has members, treat it like a constructor.
- var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
- undefined;
+ var symbol = getSymbolOfNode(func);
return !!symbol && symbol.members !== undefined;
}
return false;
@@ -48944,7 +48962,7 @@ var ts;
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
- var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
+ var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node) {