Skip to content

Commit ec0cfab

Browse files
committed
Update LKG
1 parent 8038e14 commit ec0cfab

File tree

7 files changed

+177
-64
lines changed

7 files changed

+177
-64
lines changed

lib/enu/diagnosticMessages.generated.json.lcg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,6 +3339,12 @@
33393339
</Str>
33403340
<Disp Icon="Str" />
33413341
</Item>
3342+
<Item ItemId=";JSDoc_type_0_circularly_references_itself_2587" ItemType="0" PsrId="306" Leaf="true">
3343+
<Str Cat="Text">
3344+
<Val><![CDATA[JSDoc type '{0}' circularly references itself.]]></Val>
3345+
</Str>
3346+
<Disp Icon="Str" />
3347+
</Item>
33423348
<Item ItemId=";JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021" ItemType="0" PsrId="306" Leaf="true">
33433349
<Str Cat="Text">
33443350
<Val><![CDATA[JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.]]></Val>

lib/tsc.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
6060
var ts;
6161
(function (ts) {
6262
ts.versionMajorMinor = "3.1";
63-
ts.version = ts.versionMajorMinor + ".1";
63+
ts.version = ts.versionMajorMinor + ".2";
6464
})(ts || (ts = {}));
6565
(function (ts) {
6666
ts.emptyArray = [];
@@ -3495,6 +3495,7 @@ var ts;
34953495
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'."),
34963496
_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."),
34973497
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
3498+
JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
34983499
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."),
34993500
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."),
35003501
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;
2197021971
function bindChildrenWorker(node) {
2197121972
if (checkUnreachable(node)) {
2197221973
bindEachChild(node);
21974+
bindJSDoc(node);
2197321975
return;
2197421976
}
2197521977
switch (node.kind) {
@@ -25719,7 +25721,7 @@ var ts;
2571925721
if (!result) {
2572025722
if (lastLocation) {
2572125723
ts.Debug.assert(lastLocation.kind === 277);
25722-
if (lastLocation.commonJsModuleIndicator && name === "exports") {
25724+
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
2572325725
return lastLocation.symbol;
2572425726
}
2572525727
}
@@ -26423,7 +26425,7 @@ var ts;
2642326425
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export="), dontResolveAlias), moduleSymbol)) || moduleSymbol;
2642426426
}
2642526427
function getCommonJsExportEquals(exported, moduleSymbol) {
26426-
if (!exported || moduleSymbol.exports.size === 1) {
26428+
if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
2642726429
return exported;
2642826430
}
2642926431
var merged = cloneSymbol(exported);
@@ -28196,6 +28198,8 @@ var ts;
2819628198
return !!target.resolvedReturnType;
2819728199
case 4:
2819828200
return !!target.immediateBaseConstraint;
28201+
case 6:
28202+
return !!getSymbolLinks(target).resolvedJSDocType;
2819928203
}
2820028204
return ts.Debug.assertNever(propertyName);
2820128205
}
@@ -31266,11 +31270,20 @@ var ts;
3126631270
return getTypeOfSymbol(symbol);
3126731271
}
3126831272
function getJSDocTypeReference(node, symbol, typeArguments) {
31273+
if (!pushTypeResolution(symbol, 6)) {
31274+
return errorType;
31275+
}
3126931276
var assignedType = getAssignedClassType(symbol);
3127031277
var valueType = getTypeOfSymbol(symbol);
3127131278
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
31279+
if (!popTypeResolution()) {
31280+
getSymbolLinks(symbol).resolvedJSDocType = errorType;
31281+
error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
31282+
return errorType;
31283+
}
3127231284
if (referenceType || assignedType) {
31273-
return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
31285+
var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
31286+
return getSymbolLinks(symbol).resolvedJSDocType = type;
3127431287
}
3127531288
}
3127631289
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -40665,12 +40678,16 @@ var ts;
4066540678
return result;
4066640679
}
4066740680
function isJSConstructor(node) {
40668-
if (node && ts.isInJSFile(node)) {
40681+
if (!node || !ts.isInJSFile(node)) {
40682+
return false;
40683+
}
40684+
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
40685+
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
40686+
undefined;
40687+
if (func) {
4066940688
if (ts.getJSDocClassTag(node))
4067040689
return true;
40671-
var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
40672-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
40673-
undefined;
40690+
var symbol = getSymbolOfNode(func);
4067440691
return !!symbol && symbol.members !== undefined;
4067540692
}
4067640693
return false;
@@ -40703,7 +40720,7 @@ var ts;
4070340720
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
4070440721
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
4070540722
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
40706-
var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
40723+
var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
4070740724
return init ? checkExpression(init) : undefined;
4070840725
}
4070940726
function getAssignedJSPrototype(node) {

lib/tsserver.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var ts;
8888
// If changing the text in this section, be sure to test `configureNightly` too.
8989
ts.versionMajorMinor = "3.1";
9090
/** The version of the TypeScript compiler release */
91-
ts.version = ts.versionMajorMinor + ".1";
91+
ts.version = ts.versionMajorMinor + ".2";
9292
})(ts || (ts = {}));
9393
(function (ts) {
9494
/* @internal */
@@ -5453,6 +5453,7 @@ var ts;
54535453
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'."),
54545454
_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."),
54555455
Enum_type_0_circularly_references_itself: diag(2586, ts.DiagnosticCategory.Error, "Enum_type_0_circularly_references_itself_2586", "Enum type '{0}' circularly references itself."),
5456+
JSDoc_type_0_circularly_references_itself: diag(2587, ts.DiagnosticCategory.Error, "JSDoc_type_0_circularly_references_itself_2587", "JSDoc type '{0}' circularly references itself."),
54565457
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."),
54575458
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."),
54585459
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;
2708627087
function bindChildrenWorker(node) {
2708727088
if (checkUnreachable(node)) {
2708827089
bindEachChild(node);
27090+
bindJSDoc(node);
2708927091
return;
2709027092
}
2709127093
switch (node.kind) {
@@ -30776,6 +30778,7 @@ var ts;
3077630778
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType";
3077730779
TypeSystemPropertyName[TypeSystemPropertyName["ImmediateBaseConstraint"] = 4] = "ImmediateBaseConstraint";
3077830780
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
30781+
TypeSystemPropertyName[TypeSystemPropertyName["JSDocTypeReference"] = 6] = "JSDocTypeReference";
3077930782
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
3078030783
var CheckMode;
3078130784
(function (CheckMode) {
@@ -31535,7 +31538,7 @@ var ts;
3153531538
if (!result) {
3153631539
if (lastLocation) {
3153731540
ts.Debug.assert(lastLocation.kind === 277 /* SourceFile */);
31538-
if (lastLocation.commonJsModuleIndicator && name === "exports") {
31541+
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
3153931542
return lastLocation.symbol;
3154031543
}
3154131544
}
@@ -32338,7 +32341,7 @@ var ts;
3233832341
return moduleSymbol && getMergedSymbol(getCommonJsExportEquals(resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias), moduleSymbol)) || moduleSymbol;
3233932342
}
3234032343
function getCommonJsExportEquals(exported, moduleSymbol) {
32341-
if (!exported || moduleSymbol.exports.size === 1) {
32344+
if (!exported || exported === unknownSymbol || moduleSymbol.exports.size === 1) {
3234232345
return exported;
3234332346
}
3234432347
var merged = cloneSymbol(exported);
@@ -34285,6 +34288,8 @@ var ts;
3428534288
return !!target.resolvedReturnType;
3428634289
case 4 /* ImmediateBaseConstraint */:
3428734290
return !!target.immediateBaseConstraint;
34291+
case 6 /* JSDocTypeReference */:
34292+
return !!getSymbolLinks(target).resolvedJSDocType;
3428834293
}
3428934294
return ts.Debug.assertNever(propertyName);
3429034295
}
@@ -37777,7 +37782,7 @@ var ts;
3777737782
if (type) {
3777837783
return type;
3777937784
}
37780-
// JS are 'string' or 'number', not an enum type.
37785+
// JS enums are 'string' or 'number', not an enum type.
3778137786
var enumTag = ts.isInJSFile(node) && symbol.valueDeclaration && ts.getJSDocEnumTag(symbol.valueDeclaration);
3778237787
if (enumTag) {
3778337788
var links = getNodeLinks(enumTag);
@@ -37815,12 +37820,21 @@ var ts;
3781537820
* the type of this reference is just the type of the value we resolved to.
3781637821
*/
3781737822
function getJSDocTypeReference(node, symbol, typeArguments) {
37823+
if (!pushTypeResolution(symbol, 6 /* JSDocTypeReference */)) {
37824+
return errorType;
37825+
}
3781837826
var assignedType = getAssignedClassType(symbol);
3781937827
var valueType = getTypeOfSymbol(symbol);
3782037828
var referenceType = valueType.symbol && valueType.symbol !== symbol && !isInferredClassType(valueType) && getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments);
37829+
if (!popTypeResolution()) {
37830+
getSymbolLinks(symbol).resolvedJSDocType = errorType;
37831+
error(node, ts.Diagnostics.JSDoc_type_0_circularly_references_itself, symbolToString(symbol));
37832+
return errorType;
37833+
}
3782137834
if (referenceType || assignedType) {
3782237835
// TODO: GH#18217 (should the `|| assignedType` be at a lower precedence?)
37823-
return (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
37836+
var type = (referenceType && assignedType ? getIntersectionType([assignedType, referenceType]) : referenceType || assignedType);
37837+
return getSymbolLinks(symbol).resolvedJSDocType = type;
3782437838
}
3782537839
}
3782637840
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
@@ -37945,7 +37959,7 @@ var ts;
3794537959
symbol = resolveTypeReferenceName(getTypeReferenceName(node), meaning);
3794637960
type = getTypeReferenceType(node, symbol);
3794737961
}
37948-
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
37962+
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
3794937963
// type reference in checkTypeReferenceNode.
3795037964
links.resolvedSymbol = symbol;
3795137965
links.resolvedType = type;
@@ -48904,14 +48918,18 @@ var ts;
4890448918
* file.
4890548919
*/
4890648920
function isJSConstructor(node) {
48907-
if (node && ts.isInJSFile(node)) {
48921+
if (!node || !ts.isInJSFile(node)) {
48922+
return false;
48923+
}
48924+
var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
48925+
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
48926+
undefined;
48927+
if (func) {
4890848928
// If the node has a @class tag, treat it like a constructor.
4890948929
if (ts.getJSDocClassTag(node))
4891048930
return true;
4891148931
// If the symbol of the node has members, treat it like a constructor.
48912-
var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) :
48913-
ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? getSymbolOfNode(node.initializer) :
48914-
undefined;
48932+
var symbol = getSymbolOfNode(func);
4891548933
return !!symbol && symbol.members !== undefined;
4891648934
}
4891748935
return false;
@@ -48944,7 +48962,7 @@ var ts;
4894448962
ts.isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
4894548963
ts.isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
4894648964
var prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype");
48947-
var init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
48965+
var init = prototype && prototype.valueDeclaration && getAssignedJSPrototype(prototype.valueDeclaration);
4894848966
return init ? checkExpression(init) : undefined;
4894948967
}
4895048968
function getAssignedJSPrototype(node) {

0 commit comments

Comments
 (0)