typescript 4.7.0-dev.20220417 → 4.7.0-dev.20220420
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +17 -13
- package/lib/tsserver.js +30 -16
- package/lib/tsserverlibrary.js +30 -16
- package/lib/typescript.js +30 -16
- package/lib/typescriptServices.js +30 -16
- package/lib/typingsInstaller.js +30 -16
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -26733,7 +26733,7 @@ var ts;
|
|
|
26733
26733
|
var pos = getNodePos();
|
|
26734
26734
|
parseExpected(112);
|
|
26735
26735
|
var entityName = parseEntityName(true, true);
|
|
26736
|
-
var typeArguments = tryParseTypeArguments();
|
|
26736
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
26737
26737
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
26738
26738
|
}
|
|
26739
26739
|
function parseTypeParameter() {
|
|
@@ -51418,8 +51418,11 @@ var ts;
|
|
|
51418
51418
|
return type[cache] = elementType;
|
|
51419
51419
|
}
|
|
51420
51420
|
}
|
|
51421
|
-
if (isGenericMappedType(objectType)
|
|
51422
|
-
|
|
51421
|
+
if (isGenericMappedType(objectType)) {
|
|
51422
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
51423
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
51424
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
51425
|
+
}
|
|
51423
51426
|
}
|
|
51424
51427
|
return type[cache] = type;
|
|
51425
51428
|
}
|
|
@@ -61997,7 +62000,9 @@ var ts;
|
|
|
61997
62000
|
}
|
|
61998
62001
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
61999
62002
|
}
|
|
62000
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
62003
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
62004
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 299)) ||
|
|
62005
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
62001
62006
|
markAliasReferenced(parentSymbol, node);
|
|
62002
62007
|
}
|
|
62003
62008
|
var propType;
|
|
@@ -72127,15 +72132,14 @@ var ts;
|
|
|
72127
72132
|
return propertyDeclaration;
|
|
72128
72133
|
}
|
|
72129
72134
|
}
|
|
72130
|
-
else if (ts.isMetaProperty(parent)) {
|
|
72131
|
-
|
|
72132
|
-
var propertyDeclaration = getPropertyOfType(parentType, node.escapedText);
|
|
72133
|
-
if (propertyDeclaration) {
|
|
72134
|
-
return propertyDeclaration;
|
|
72135
|
-
}
|
|
72136
|
-
if (parent.keywordToken === 103) {
|
|
72135
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
72136
|
+
if (parent.keywordToken === 103 && ts.idText(node) === "target") {
|
|
72137
72137
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
72138
72138
|
}
|
|
72139
|
+
if (parent.keywordToken === 100 && ts.idText(node) === "meta") {
|
|
72140
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
72141
|
+
}
|
|
72142
|
+
return undefined;
|
|
72139
72143
|
}
|
|
72140
72144
|
}
|
|
72141
72145
|
switch (node.kind) {
|
|
@@ -82349,7 +82353,7 @@ var ts;
|
|
|
82349
82353
|
else {
|
|
82350
82354
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
82351
82355
|
}
|
|
82352
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)), constructor.body.statements), true);
|
|
82356
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)), constructor.body.statements), true);
|
|
82353
82357
|
ts.setTextRange(body, constructor.body);
|
|
82354
82358
|
return body;
|
|
82355
82359
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -33186,7 +33186,8 @@ var ts;
|
|
|
33186
33186
|
var pos = getNodePos();
|
|
33187
33187
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33188
33188
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33189
|
-
|
|
33189
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33190
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33190
33191
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33191
33192
|
}
|
|
33192
33193
|
function parseTypeParameter() {
|
|
@@ -61934,11 +61935,14 @@ var ts;
|
|
|
61934
61935
|
return type[cache] = elementType;
|
|
61935
61936
|
}
|
|
61936
61937
|
}
|
|
61937
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
61938
|
-
//
|
|
61939
|
-
// construct the type Box<T[X]>.
|
|
61940
|
-
if (isGenericMappedType(objectType)
|
|
61941
|
-
|
|
61938
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
61939
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
61940
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
61941
|
+
if (isGenericMappedType(objectType)) {
|
|
61942
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
61943
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61944
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61945
|
+
}
|
|
61942
61946
|
}
|
|
61943
61947
|
return type[cache] = type;
|
|
61944
61948
|
}
|
|
@@ -74258,10 +74262,15 @@ var ts;
|
|
|
74258
74262
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74259
74263
|
}
|
|
74260
74264
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74265
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74266
|
+
// here even if `Foo` is not a const enum.
|
|
74267
|
+
//
|
|
74261
74268
|
// The exceptions are:
|
|
74262
74269
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74263
74270
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74264
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74271
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74272
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74273
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74265
74274
|
markAliasReferenced(parentSymbol, node);
|
|
74266
74275
|
}
|
|
74267
74276
|
var propType;
|
|
@@ -85996,15 +86005,20 @@ var ts;
|
|
|
85996
86005
|
return propertyDeclaration;
|
|
85997
86006
|
}
|
|
85998
86007
|
}
|
|
85999
|
-
else if (ts.isMetaProperty(parent)) {
|
|
86000
|
-
|
|
86001
|
-
|
|
86002
|
-
if (propertyDeclaration) {
|
|
86003
|
-
return propertyDeclaration;
|
|
86004
|
-
}
|
|
86005
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86008
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86009
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86010
|
+
// `target` in `new.target`
|
|
86006
86011
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
86007
86012
|
}
|
|
86013
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86014
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86015
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86016
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86017
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86018
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86019
|
+
}
|
|
86020
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86021
|
+
return undefined;
|
|
86008
86022
|
}
|
|
86009
86023
|
}
|
|
86010
86024
|
switch (node.kind) {
|
|
@@ -98794,7 +98808,7 @@ var ts;
|
|
|
98794
98808
|
// ```
|
|
98795
98809
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98796
98810
|
}
|
|
98797
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
98811
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98798
98812
|
/*location*/ constructor.body.statements),
|
|
98799
98813
|
/*multiLine*/ true);
|
|
98800
98814
|
ts.setTextRange(body, constructor.body);
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -33380,7 +33380,8 @@ var ts;
|
|
|
33380
33380
|
var pos = getNodePos();
|
|
33381
33381
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33382
33382
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33383
|
-
|
|
33383
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33384
33385
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33385
33386
|
}
|
|
33386
33387
|
function parseTypeParameter() {
|
|
@@ -62128,11 +62129,14 @@ var ts;
|
|
|
62128
62129
|
return type[cache] = elementType;
|
|
62129
62130
|
}
|
|
62130
62131
|
}
|
|
62131
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
62132
|
-
//
|
|
62133
|
-
// construct the type Box<T[X]>.
|
|
62134
|
-
if (isGenericMappedType(objectType)
|
|
62135
|
-
|
|
62132
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
62133
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
62134
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
62135
|
+
if (isGenericMappedType(objectType)) {
|
|
62136
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
62137
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
62138
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
62139
|
+
}
|
|
62136
62140
|
}
|
|
62137
62141
|
return type[cache] = type;
|
|
62138
62142
|
}
|
|
@@ -74452,10 +74456,15 @@ var ts;
|
|
|
74452
74456
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74453
74457
|
}
|
|
74454
74458
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74459
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74460
|
+
// here even if `Foo` is not a const enum.
|
|
74461
|
+
//
|
|
74455
74462
|
// The exceptions are:
|
|
74456
74463
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74457
74464
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74458
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74465
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74466
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74467
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74459
74468
|
markAliasReferenced(parentSymbol, node);
|
|
74460
74469
|
}
|
|
74461
74470
|
var propType;
|
|
@@ -86190,15 +86199,20 @@ var ts;
|
|
|
86190
86199
|
return propertyDeclaration;
|
|
86191
86200
|
}
|
|
86192
86201
|
}
|
|
86193
|
-
else if (ts.isMetaProperty(parent)) {
|
|
86194
|
-
|
|
86195
|
-
|
|
86196
|
-
if (propertyDeclaration) {
|
|
86197
|
-
return propertyDeclaration;
|
|
86198
|
-
}
|
|
86199
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86202
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86203
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86204
|
+
// `target` in `new.target`
|
|
86200
86205
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
86201
86206
|
}
|
|
86207
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86208
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86209
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86210
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86211
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86212
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86213
|
+
}
|
|
86214
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86215
|
+
return undefined;
|
|
86202
86216
|
}
|
|
86203
86217
|
}
|
|
86204
86218
|
switch (node.kind) {
|
|
@@ -98988,7 +99002,7 @@ var ts;
|
|
|
98988
99002
|
// ```
|
|
98989
99003
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98990
99004
|
}
|
|
98991
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
99005
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98992
99006
|
/*location*/ constructor.body.statements),
|
|
98993
99007
|
/*multiLine*/ true);
|
|
98994
99008
|
ts.setTextRange(body, constructor.body);
|
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -33380,7 +33380,8 @@ var ts;
|
|
|
33380
33380
|
var pos = getNodePos();
|
|
33381
33381
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33382
33382
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33383
|
-
|
|
33383
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33384
33385
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33385
33386
|
}
|
|
33386
33387
|
function parseTypeParameter() {
|
|
@@ -62128,11 +62129,14 @@ var ts;
|
|
|
62128
62129
|
return type[cache] = elementType;
|
|
62129
62130
|
}
|
|
62130
62131
|
}
|
|
62131
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
62132
|
-
//
|
|
62133
|
-
// construct the type Box<T[X]>.
|
|
62134
|
-
if (isGenericMappedType(objectType)
|
|
62135
|
-
|
|
62132
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
62133
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
62134
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
62135
|
+
if (isGenericMappedType(objectType)) {
|
|
62136
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
62137
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
62138
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
62139
|
+
}
|
|
62136
62140
|
}
|
|
62137
62141
|
return type[cache] = type;
|
|
62138
62142
|
}
|
|
@@ -74452,10 +74456,15 @@ var ts;
|
|
|
74452
74456
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74453
74457
|
}
|
|
74454
74458
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74459
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74460
|
+
// here even if `Foo` is not a const enum.
|
|
74461
|
+
//
|
|
74455
74462
|
// The exceptions are:
|
|
74456
74463
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74457
74464
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74458
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74465
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74466
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74467
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74459
74468
|
markAliasReferenced(parentSymbol, node);
|
|
74460
74469
|
}
|
|
74461
74470
|
var propType;
|
|
@@ -86190,15 +86199,20 @@ var ts;
|
|
|
86190
86199
|
return propertyDeclaration;
|
|
86191
86200
|
}
|
|
86192
86201
|
}
|
|
86193
|
-
else if (ts.isMetaProperty(parent)) {
|
|
86194
|
-
|
|
86195
|
-
|
|
86196
|
-
if (propertyDeclaration) {
|
|
86197
|
-
return propertyDeclaration;
|
|
86198
|
-
}
|
|
86199
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86202
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86203
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86204
|
+
// `target` in `new.target`
|
|
86200
86205
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
86201
86206
|
}
|
|
86207
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86208
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86209
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86210
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86211
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86212
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86213
|
+
}
|
|
86214
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86215
|
+
return undefined;
|
|
86202
86216
|
}
|
|
86203
86217
|
}
|
|
86204
86218
|
switch (node.kind) {
|
|
@@ -98988,7 +99002,7 @@ var ts;
|
|
|
98988
99002
|
// ```
|
|
98989
99003
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98990
99004
|
}
|
|
98991
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
99005
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98992
99006
|
/*location*/ constructor.body.statements),
|
|
98993
99007
|
/*multiLine*/ true);
|
|
98994
99008
|
ts.setTextRange(body, constructor.body);
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -33380,7 +33380,8 @@ var ts;
|
|
|
33380
33380
|
var pos = getNodePos();
|
|
33381
33381
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33382
33382
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33383
|
-
|
|
33383
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33384
33385
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33385
33386
|
}
|
|
33386
33387
|
function parseTypeParameter() {
|
|
@@ -62128,11 +62129,14 @@ var ts;
|
|
|
62128
62129
|
return type[cache] = elementType;
|
|
62129
62130
|
}
|
|
62130
62131
|
}
|
|
62131
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
62132
|
-
//
|
|
62133
|
-
// construct the type Box<T[X]>.
|
|
62134
|
-
if (isGenericMappedType(objectType)
|
|
62135
|
-
|
|
62132
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
62133
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
62134
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
62135
|
+
if (isGenericMappedType(objectType)) {
|
|
62136
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
62137
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
62138
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
62139
|
+
}
|
|
62136
62140
|
}
|
|
62137
62141
|
return type[cache] = type;
|
|
62138
62142
|
}
|
|
@@ -74452,10 +74456,15 @@ var ts;
|
|
|
74452
74456
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74453
74457
|
}
|
|
74454
74458
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74459
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74460
|
+
// here even if `Foo` is not a const enum.
|
|
74461
|
+
//
|
|
74455
74462
|
// The exceptions are:
|
|
74456
74463
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74457
74464
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74458
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74465
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74466
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74467
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74459
74468
|
markAliasReferenced(parentSymbol, node);
|
|
74460
74469
|
}
|
|
74461
74470
|
var propType;
|
|
@@ -86190,15 +86199,20 @@ var ts;
|
|
|
86190
86199
|
return propertyDeclaration;
|
|
86191
86200
|
}
|
|
86192
86201
|
}
|
|
86193
|
-
else if (ts.isMetaProperty(parent)) {
|
|
86194
|
-
|
|
86195
|
-
|
|
86196
|
-
if (propertyDeclaration) {
|
|
86197
|
-
return propertyDeclaration;
|
|
86198
|
-
}
|
|
86199
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86202
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86203
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86204
|
+
// `target` in `new.target`
|
|
86200
86205
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
86201
86206
|
}
|
|
86207
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86208
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86209
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86210
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86211
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86212
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86213
|
+
}
|
|
86214
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86215
|
+
return undefined;
|
|
86202
86216
|
}
|
|
86203
86217
|
}
|
|
86204
86218
|
switch (node.kind) {
|
|
@@ -98988,7 +99002,7 @@ var ts;
|
|
|
98988
99002
|
// ```
|
|
98989
99003
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98990
99004
|
}
|
|
98991
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
99005
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98992
99006
|
/*location*/ constructor.body.statements),
|
|
98993
99007
|
/*multiLine*/ true);
|
|
98994
99008
|
ts.setTextRange(body, constructor.body);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220420";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -33175,7 +33175,8 @@ var ts;
|
|
|
33175
33175
|
var pos = getNodePos();
|
|
33176
33176
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33177
33177
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33178
|
-
|
|
33178
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33179
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33179
33180
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33180
33181
|
}
|
|
33181
33182
|
function parseTypeParameter() {
|
|
@@ -61923,11 +61924,14 @@ var ts;
|
|
|
61923
61924
|
return type[cache] = elementType;
|
|
61924
61925
|
}
|
|
61925
61926
|
}
|
|
61926
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
61927
|
-
//
|
|
61928
|
-
// construct the type Box<T[X]>.
|
|
61929
|
-
if (isGenericMappedType(objectType)
|
|
61930
|
-
|
|
61927
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
61928
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
61929
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
61930
|
+
if (isGenericMappedType(objectType)) {
|
|
61931
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
61932
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61933
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61934
|
+
}
|
|
61931
61935
|
}
|
|
61932
61936
|
return type[cache] = type;
|
|
61933
61937
|
}
|
|
@@ -74247,10 +74251,15 @@ var ts;
|
|
|
74247
74251
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74248
74252
|
}
|
|
74249
74253
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74254
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74255
|
+
// here even if `Foo` is not a const enum.
|
|
74256
|
+
//
|
|
74250
74257
|
// The exceptions are:
|
|
74251
74258
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74252
74259
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74253
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74260
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74261
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74262
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74254
74263
|
markAliasReferenced(parentSymbol, node);
|
|
74255
74264
|
}
|
|
74256
74265
|
var propType;
|
|
@@ -85985,15 +85994,20 @@ var ts;
|
|
|
85985
85994
|
return propertyDeclaration;
|
|
85986
85995
|
}
|
|
85987
85996
|
}
|
|
85988
|
-
else if (ts.isMetaProperty(parent)) {
|
|
85989
|
-
|
|
85990
|
-
|
|
85991
|
-
if (propertyDeclaration) {
|
|
85992
|
-
return propertyDeclaration;
|
|
85993
|
-
}
|
|
85994
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
85997
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
85998
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
85999
|
+
// `target` in `new.target`
|
|
85995
86000
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
85996
86001
|
}
|
|
86002
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86003
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86004
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86005
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86006
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86007
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86008
|
+
}
|
|
86009
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86010
|
+
return undefined;
|
|
85997
86011
|
}
|
|
85998
86012
|
}
|
|
85999
86013
|
switch (node.kind) {
|
|
@@ -98783,7 +98797,7 @@ var ts;
|
|
|
98783
98797
|
// ```
|
|
98784
98798
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98785
98799
|
}
|
|
98786
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
98800
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98787
98801
|
/*location*/ constructor.body.statements),
|
|
98788
98802
|
/*multiLine*/ true);
|
|
98789
98803
|
ts.setTextRange(body, constructor.body);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.7.0-dev.
|
|
5
|
+
"version": "4.7.0-dev.20220420",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|