Skip to content

Commit 501bfb5

Browse files
committed
Update LKG
1 parent 6ea1038 commit 501bfb5

9 files changed

+236
-82
lines changed

lib/lib.es2017.object.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,22 @@ interface ObjectConstructor {
2424
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
2525
*/
2626
values<T>(o: { [s: string]: T }): T[];
27+
28+
/**
29+
* Returns an array of values of the enumerable properties of an object
30+
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
31+
*/
2732
values(o: any): any[];
33+
34+
/**
35+
* Returns an array of key/values of the enumerable properties of an object
36+
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
37+
*/
38+
entries<T>(o: { [s: string]: T }): [string, T][];
39+
2840
/**
2941
* Returns an array of key/values of the enumerable properties of an object
3042
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
3143
*/
32-
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][];
3344
entries(o: any): [string, any][];
3445
}

lib/protocol.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,34 @@ declare namespace ts.server.protocol {
16621662
*/
16631663
typingsInstallerVersion: string;
16641664
}
1665+
type BeginInstallTypesEventName = "beginInstallTypes";
1666+
type EndInstallTypesEventName = "endInstallTypes";
1667+
interface BeginInstallTypesEvent extends Event {
1668+
event: BeginInstallTypesEventName;
1669+
body: BeginInstallTypesEventBody;
1670+
}
1671+
interface EndInstallTypesEvent extends Event {
1672+
event: EndInstallTypesEventName;
1673+
body: EndInstallTypesEventBody;
1674+
}
1675+
interface InstallTypesEventBody {
1676+
/**
1677+
* correlation id to match begin and end events
1678+
*/
1679+
eventId: number;
1680+
/**
1681+
* list of packages to install
1682+
*/
1683+
packages: ReadonlyArray<string>;
1684+
}
1685+
interface BeginInstallTypesEventBody extends InstallTypesEventBody {
1686+
}
1687+
interface EndInstallTypesEventBody extends InstallTypesEventBody {
1688+
/**
1689+
* true if installation succeeded, otherwise false
1690+
*/
1691+
success: boolean;
1692+
}
16651693
interface NavBarResponse extends Response {
16661694
body?: NavigationBarItem[];
16671695
}

lib/tsc.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,6 +2624,7 @@ var ts;
26242624
Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." },
26252625
Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." },
26262626
A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." },
2627+
An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." },
26272628
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." },
26282629
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
26292630
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." },
@@ -23058,24 +23059,27 @@ var ts;
2305823059
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
2305923060
var typeParameter = getTypeParameterFromMappedType(type);
2306023061
var constraintType = getConstraintTypeFromMappedType(type);
23062+
var isomorphicType = getIsomorphicTypeFromMappedType(type);
2306123063
var templateType = getTemplateTypeFromMappedType(type);
23062-
var isReadonly = !!type.declaration.readonlyToken;
23063-
var isOptional = !!type.declaration.questionToken;
23064+
var templateReadonly = !!type.declaration.readonlyToken;
23065+
var templateOptional = !!type.declaration.questionToken;
2306423066
var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType;
2306523067
var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType;
2306623068
forEachType(iterationType, function (t) {
2306723069
var iterationMapper = createUnaryTypeMapper(typeParameter, t);
2306823070
var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper;
2306923071
var propType = instantiateType(templateType, templateMapper);
23070-
if (t.flags & (32 | 64 | 256)) {
23072+
if (t.flags & 32) {
2307123073
var propName = t.text;
23074+
var isomorphicProp = isomorphicType && getPropertyOfType(isomorphicType, propName);
23075+
var isOptional = templateOptional || !!(isomorphicProp && isomorphicProp.flags & 536870912);
2307223076
var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName);
2307323077
prop.type = addOptionality(propType, isOptional);
23074-
prop.isReadonly = isReadonly;
23078+
prop.isReadonly = templateReadonly || isomorphicProp && isReadonlySymbol(isomorphicProp);
2307523079
members[propName] = prop;
2307623080
}
2307723081
else if (t.flags & 2) {
23078-
stringIndexInfo = createIndexInfo(propType, isReadonly);
23082+
stringIndexInfo = createIndexInfo(propType, templateReadonly);
2307923083
}
2308023084
});
2308123085
setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);
@@ -23094,6 +23098,10 @@ var ts;
2309423098
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
2309523099
unknownType);
2309623100
}
23101+
function getIsomorphicTypeFromMappedType(type) {
23102+
var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));
23103+
return constraint.kind === 168 ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;
23104+
}
2309723105
function getErasedTemplateTypeFromMappedType(type) {
2309823106
return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
2309923107
}
@@ -35913,6 +35921,9 @@ var ts;
3591335921
else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) {
3591435922
return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
3591535923
}
35924+
else if (accessor.body && ts.getModifierFlags(accessor) & 128) {
35925+
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
35926+
}
3591635927
else if (accessor.typeParameters) {
3591735928
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
3591835929
}

lib/tsserver.js

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,6 +2629,7 @@ var ts;
26292629
Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." },
26302630
Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." },
26312631
A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." },
2632+
An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." },
26322633
Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." },
26332634
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
26342635
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." },
@@ -6069,7 +6070,8 @@ var ts;
60696070
(function (server) {
60706071
server.ActionSet = "action::set";
60716072
server.ActionInvalidate = "action::invalidate";
6072-
server.EventInstall = "event::install";
6073+
server.EventBeginInstallTypes = "event::beginInstallTypes";
6074+
server.EventEndInstallTypes = "event::endInstallTypes";
60736075
var Arguments;
60746076
(function (Arguments) {
60756077
Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation";
@@ -24571,24 +24573,27 @@ var ts;
2457124573
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
2457224574
var typeParameter = getTypeParameterFromMappedType(type);
2457324575
var constraintType = getConstraintTypeFromMappedType(type);
24576+
var isomorphicType = getIsomorphicTypeFromMappedType(type);
2457424577
var templateType = getTemplateTypeFromMappedType(type);
24575-
var isReadonly = !!type.declaration.readonlyToken;
24576-
var isOptional = !!type.declaration.questionToken;
24578+
var templateReadonly = !!type.declaration.readonlyToken;
24579+
var templateOptional = !!type.declaration.questionToken;
2457724580
var keyType = constraintType.flags & 16384 ? getApparentType(constraintType) : constraintType;
2457824581
var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType;
2457924582
forEachType(iterationType, function (t) {
2458024583
var iterationMapper = createUnaryTypeMapper(typeParameter, t);
2458124584
var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper;
2458224585
var propType = instantiateType(templateType, templateMapper);
24583-
if (t.flags & (32 | 64 | 256)) {
24586+
if (t.flags & 32) {
2458424587
var propName = t.text;
24588+
var isomorphicProp = isomorphicType && getPropertyOfType(isomorphicType, propName);
24589+
var isOptional = templateOptional || !!(isomorphicProp && isomorphicProp.flags & 536870912);
2458524590
var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName);
2458624591
prop.type = addOptionality(propType, isOptional);
24587-
prop.isReadonly = isReadonly;
24592+
prop.isReadonly = templateReadonly || isomorphicProp && isReadonlySymbol(isomorphicProp);
2458824593
members[propName] = prop;
2458924594
}
2459024595
else if (t.flags & 2) {
24591-
stringIndexInfo = createIndexInfo(propType, isReadonly);
24596+
stringIndexInfo = createIndexInfo(propType, templateReadonly);
2459224597
}
2459324598
});
2459424599
setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined);
@@ -24607,6 +24612,10 @@ var ts;
2460724612
instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) :
2460824613
unknownType);
2460924614
}
24615+
function getIsomorphicTypeFromMappedType(type) {
24616+
var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));
24617+
return constraint.kind === 168 ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;
24618+
}
2461024619
function getErasedTemplateTypeFromMappedType(type) {
2461124620
return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
2461224621
}
@@ -37426,6 +37435,9 @@ var ts;
3742637435
else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) {
3742737436
return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
3742837437
}
37438+
else if (accessor.body && ts.getModifierFlags(accessor) & 128) {
37439+
return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation);
37440+
}
3742937441
else if (accessor.typeParameters) {
3743037442
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
3743137443
}
@@ -69090,7 +69102,7 @@ var ts;
6909069102
this.socket.write(server.formatMessage({ seq: seq, type: "event", event: event, body: body }, this.logger, Buffer.byteLength, this.newLine), "utf8");
6909169103
};
6909269104
NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) {
69093-
this.telemetrySender = telemetrySender;
69105+
this.eventSender = telemetrySender;
6909469106
};
6909569107
NodeTypingsInstaller.prototype.attach = function (projectService) {
6909669108
var _this = this;
@@ -69148,19 +69160,41 @@ var ts;
6914869160
if (this.logger.hasLevel(server.LogLevel.verbose)) {
6914969161
this.logger.info("Received response: " + JSON.stringify(response));
6915069162
}
69151-
if (response.kind === server.EventInstall) {
69152-
if (this.telemetrySender) {
69153-
var body = {
69163+
if (response.kind === server.EventBeginInstallTypes) {
69164+
if (!this.eventSender) {
69165+
return;
69166+
}
69167+
var body = {
69168+
eventId: response.eventId,
69169+
packages: response.packagesToInstall,
69170+
};
69171+
var eventName = "beginInstallTypes";
69172+
this.eventSender.event(body, eventName);
69173+
return;
69174+
}
69175+
if (response.kind === server.EventEndInstallTypes) {
69176+
if (!this.eventSender) {
69177+
return;
69178+
}
69179+
if (this.telemetryEnabled) {
69180+
var body_1 = {
6915469181
telemetryEventName: "typingsInstalled",
6915569182
payload: {
6915669183
installedPackages: response.packagesToInstall.join(","),
6915769184
installSuccess: response.installSuccess,
6915869185
typingsInstallerVersion: response.typingsInstallerVersion
6915969186
}
6916069187
};
69161-
var eventName = "telemetry";
69162-
this.telemetrySender.event(body, eventName);
69188+
var eventName_1 = "telemetry";
69189+
this.eventSender.event(body_1, eventName_1);
6916369190
}
69191+
var body = {
69192+
eventId: response.eventId,
69193+
packages: response.packagesToInstall,
69194+
success: response.installSuccess,
69195+
};
69196+
var eventName = "endInstallTypes";
69197+
this.eventSender.event(body, eventName);
6916469198
return;
6916569199
}
6916669200
this.projectService.updateTypingsForProject(response);

lib/tsserverlibrary.d.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,25 @@ declare namespace ts.server.protocol {
718718
installSuccess: boolean;
719719
typingsInstallerVersion: string;
720720
}
721+
type BeginInstallTypesEventName = "beginInstallTypes";
722+
type EndInstallTypesEventName = "endInstallTypes";
723+
interface BeginInstallTypesEvent extends Event {
724+
event: BeginInstallTypesEventName;
725+
body: BeginInstallTypesEventBody;
726+
}
727+
interface EndInstallTypesEvent extends Event {
728+
event: EndInstallTypesEventName;
729+
body: EndInstallTypesEventBody;
730+
}
731+
interface InstallTypesEventBody {
732+
eventId: number;
733+
packages: ReadonlyArray<string>;
734+
}
735+
interface BeginInstallTypesEventBody extends InstallTypesEventBody {
736+
}
737+
interface EndInstallTypesEventBody extends InstallTypesEventBody {
738+
success: boolean;
739+
}
721740
interface NavBarResponse extends Response {
722741
body?: NavigationBarItem[];
723742
}
@@ -5075,6 +5094,12 @@ declare namespace ts {
50755094
key: string;
50765095
message: string;
50775096
};
5097+
An_abstract_accessor_cannot_have_an_implementation: {
5098+
code: number;
5099+
category: DiagnosticCategory;
5100+
key: string;
5101+
message: string;
5102+
};
50785103
Duplicate_identifier_0: {
50795104
code: number;
50805105
category: DiagnosticCategory;
@@ -8731,7 +8756,8 @@ declare namespace ts.JsTyping {
87318756
declare namespace ts.server {
87328757
const ActionSet: ActionSet;
87338758
const ActionInvalidate: ActionInvalidate;
8734-
const EventInstall: EventInstall;
8759+
const EventBeginInstallTypes: EventBeginInstallTypes;
8760+
const EventEndInstallTypes: EventEndInstallTypes;
87358761
namespace Arguments {
87368762
const GlobalCacheLocation = "--globalTypingsCacheLocation";
87378763
const LogFile = "--logFile";

0 commit comments

Comments
 (0)