@typescript-deploys/pr-build 5.5.0-pr-57717-2 → 5.5.0-pr-57749-2
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 +148 -65
- package/lib/tsserver.js +285 -147
- package/lib/typescript.js +285 -147
- package/lib/typingsInstaller.js +5 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240312`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6096,6 +6096,8 @@ var Diagnostics = {
|
|
|
6096
6096
|
The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
|
|
6097
6097
|
_0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
|
|
6098
6098
|
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
6099
|
+
Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator: diag(1497, 1 /* Error */, "Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator_1497", "Expression must be enclosed in parentheses to be used as a decorator."),
|
|
6100
|
+
Invalid_syntax_in_decorator: diag(1498, 1 /* Error */, "Invalid_syntax_in_decorator_1498", "Invalid syntax in decorator."),
|
|
6099
6101
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6100
6102
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6101
6103
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -7743,6 +7745,8 @@ var Diagnostics = {
|
|
|
7743
7745
|
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
7744
7746
|
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
7745
7747
|
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7748
|
+
Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
|
|
7749
|
+
Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
|
|
7746
7750
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7747
7751
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7748
7752
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -17570,7 +17574,7 @@ function canUsePropertyAccess(name, languageVersion) {
|
|
|
17570
17574
|
}
|
|
17571
17575
|
function isJSDocOptionalParameter(node) {
|
|
17572
17576
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
17573
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
17577
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
17574
17578
|
}
|
|
17575
17579
|
function isOptionalDeclaration(declaration) {
|
|
17576
17580
|
switch (declaration.kind) {
|
|
@@ -44179,8 +44183,6 @@ function createTypeChecker(host) {
|
|
|
44179
44183
|
var comparableRelation = /* @__PURE__ */ new Map();
|
|
44180
44184
|
var identityRelation = /* @__PURE__ */ new Map();
|
|
44181
44185
|
var enumRelation = /* @__PURE__ */ new Map();
|
|
44182
|
-
var builtinGlobals = createSymbolTable();
|
|
44183
|
-
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
44184
44186
|
var suggestedExtensions = [
|
|
44185
44187
|
[".mts", ".mjs"],
|
|
44186
44188
|
[".ts", ".js"],
|
|
@@ -44598,17 +44600,17 @@ function createTypeChecker(host) {
|
|
|
44598
44600
|
}
|
|
44599
44601
|
}
|
|
44600
44602
|
}
|
|
44601
|
-
function
|
|
44602
|
-
|
|
44603
|
-
|
|
44604
|
-
|
|
44605
|
-
|
|
44606
|
-
|
|
44607
|
-
|
|
44608
|
-
|
|
44609
|
-
|
|
44610
|
-
|
|
44611
|
-
|
|
44603
|
+
function addUndefinedToGlobalsOrErrorOnRedeclaration() {
|
|
44604
|
+
const name = undefinedSymbol.escapedName;
|
|
44605
|
+
const targetSymbol = globals.get(name);
|
|
44606
|
+
if (targetSymbol) {
|
|
44607
|
+
forEach(targetSymbol.declarations, (declaration) => {
|
|
44608
|
+
if (!isTypeDeclaration(declaration)) {
|
|
44609
|
+
diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, unescapeLeadingUnderscores(name)));
|
|
44610
|
+
}
|
|
44611
|
+
});
|
|
44612
|
+
} else {
|
|
44613
|
+
globals.set(name, undefinedSymbol);
|
|
44612
44614
|
}
|
|
44613
44615
|
}
|
|
44614
44616
|
function getSymbolLinks(symbol) {
|
|
@@ -44678,7 +44680,14 @@ function createTypeChecker(host) {
|
|
|
44678
44680
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
44679
44681
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
44680
44682
|
} else if (isClassLike(declaration)) {
|
|
44681
|
-
|
|
44683
|
+
const container = findAncestor(usage, (n) => n === declaration ? "quit" : isComputedPropertyName(n) ? n.parent.parent === declaration : isDecorator(n) && (n.parent === declaration || isMethodDeclaration(n.parent) && n.parent.parent === declaration || isGetOrSetAccessorDeclaration(n.parent) && n.parent.parent === declaration || isPropertyDeclaration(n.parent) && n.parent.parent === declaration || isParameter(n.parent) && n.parent.parent.parent === declaration));
|
|
44684
|
+
if (!container) {
|
|
44685
|
+
return true;
|
|
44686
|
+
}
|
|
44687
|
+
if (isDecorator(container)) {
|
|
44688
|
+
return !!findAncestor(usage, (n) => n === container ? "quit" : isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n));
|
|
44689
|
+
}
|
|
44690
|
+
return false;
|
|
44682
44691
|
} else if (isPropertyDeclaration(declaration)) {
|
|
44683
44692
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
44684
44693
|
declaration,
|
|
@@ -53563,7 +53572,7 @@ function createTypeChecker(host) {
|
|
|
53563
53572
|
if (!lateSymbol)
|
|
53564
53573
|
lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
|
|
53565
53574
|
const earlySymbol = earlySymbols && earlySymbols.get(memberName);
|
|
53566
|
-
if (!(parent.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) {
|
|
53575
|
+
if (!(parent.flags & 32 /* Class */) && (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol)) {
|
|
53567
53576
|
const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
|
|
53568
53577
|
const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName);
|
|
53569
53578
|
forEach(declarations, (declaration) => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name));
|
|
@@ -55351,10 +55360,16 @@ function createTypeChecker(host) {
|
|
|
55351
55360
|
const symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
55352
55361
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
55353
55362
|
}
|
|
55363
|
+
function hasEffectiveQuestionToken(node) {
|
|
55364
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
55365
|
+
}
|
|
55354
55366
|
function isOptionalParameter(node) {
|
|
55355
|
-
if (
|
|
55367
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
55356
55368
|
return true;
|
|
55357
55369
|
}
|
|
55370
|
+
if (!isParameter(node)) {
|
|
55371
|
+
return false;
|
|
55372
|
+
}
|
|
55358
55373
|
if (node.initializer) {
|
|
55359
55374
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
55360
55375
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -55454,7 +55469,7 @@ function createTypeChecker(host) {
|
|
|
55454
55469
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
55455
55470
|
flags |= 2 /* HasLiteralTypes */;
|
|
55456
55471
|
}
|
|
55457
|
-
const isOptionalParameter2 =
|
|
55472
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
55458
55473
|
if (!isOptionalParameter2) {
|
|
55459
55474
|
minArgumentCount = parameters.length;
|
|
55460
55475
|
}
|
|
@@ -60572,7 +60587,7 @@ function createTypeChecker(host) {
|
|
|
60572
60587
|
if (reduced !== type) {
|
|
60573
60588
|
return reduced;
|
|
60574
60589
|
}
|
|
60575
|
-
if (type.flags & 2097152 /* Intersection */ &&
|
|
60590
|
+
if (type.flags & 2097152 /* Intersection */ && shouldNormalizeIntersection(type)) {
|
|
60576
60591
|
const normalizedTypes = sameMap(type.types, (t) => getNormalizedType(t, writing));
|
|
60577
60592
|
if (normalizedTypes !== type.types) {
|
|
60578
60593
|
return getIntersectionType(normalizedTypes);
|
|
@@ -60580,6 +60595,17 @@ function createTypeChecker(host) {
|
|
|
60580
60595
|
}
|
|
60581
60596
|
return type;
|
|
60582
60597
|
}
|
|
60598
|
+
function shouldNormalizeIntersection(type) {
|
|
60599
|
+
let hasInstantiable = false;
|
|
60600
|
+
let hasNullableOrEmpty = false;
|
|
60601
|
+
for (const t of type.types) {
|
|
60602
|
+
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
|
60603
|
+
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
|
60604
|
+
if (hasInstantiable && hasNullableOrEmpty)
|
|
60605
|
+
return true;
|
|
60606
|
+
}
|
|
60607
|
+
return false;
|
|
60608
|
+
}
|
|
60583
60609
|
function getNormalizedTupleType(type, writing) {
|
|
60584
60610
|
const elements = getElementTypes(type);
|
|
60585
60611
|
const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
@@ -65430,9 +65456,9 @@ function createTypeChecker(host) {
|
|
|
65430
65456
|
if (strictNullChecks) {
|
|
65431
65457
|
switch (facts) {
|
|
65432
65458
|
case 524288 /* NEUndefined */:
|
|
65433
|
-
return
|
|
65459
|
+
return removeNullableByIntersection(reduced, 65536 /* EQUndefined */, 131072 /* EQNull */, 33554432 /* IsNull */, nullType);
|
|
65434
65460
|
case 1048576 /* NENull */:
|
|
65435
|
-
return
|
|
65461
|
+
return removeNullableByIntersection(reduced, 131072 /* EQNull */, 65536 /* EQUndefined */, 16777216 /* IsUndefined */, undefinedType);
|
|
65436
65462
|
case 2097152 /* NEUndefinedOrNull */:
|
|
65437
65463
|
case 4194304 /* Truthy */:
|
|
65438
65464
|
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
@@ -65440,6 +65466,14 @@ function createTypeChecker(host) {
|
|
|
65440
65466
|
}
|
|
65441
65467
|
return reduced;
|
|
65442
65468
|
}
|
|
65469
|
+
function removeNullableByIntersection(type, targetFacts, otherFacts, otherIncludesFacts, otherType) {
|
|
65470
|
+
const facts = getTypeFacts(type, 65536 /* EQUndefined */ | 131072 /* EQNull */ | 16777216 /* IsUndefined */ | 33554432 /* IsNull */);
|
|
65471
|
+
if (!(facts & targetFacts)) {
|
|
65472
|
+
return type;
|
|
65473
|
+
}
|
|
65474
|
+
const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
|
|
65475
|
+
return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
|
|
65476
|
+
}
|
|
65443
65477
|
function recombineUnknownType(type) {
|
|
65444
65478
|
return type === unknownUnionType ? unknownType : type;
|
|
65445
65479
|
}
|
|
@@ -69007,7 +69041,7 @@ function createTypeChecker(host) {
|
|
|
69007
69041
|
}
|
|
69008
69042
|
}
|
|
69009
69043
|
function checkSpreadExpression(node, checkMode) {
|
|
69010
|
-
if (languageVersion < 2 /*
|
|
69044
|
+
if (languageVersion < 2 /* SpreadElements */) {
|
|
69011
69045
|
checkExternalEmitHelpers(node, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
|
|
69012
69046
|
}
|
|
69013
69047
|
const arrayOrIterableType = checkExpression(node.expression, checkMode);
|
|
@@ -69041,7 +69075,7 @@ function createTypeChecker(host) {
|
|
|
69041
69075
|
for (let i = 0; i < elementCount; i++) {
|
|
69042
69076
|
const e = elements[i];
|
|
69043
69077
|
if (e.kind === 230 /* SpreadElement */) {
|
|
69044
|
-
if (languageVersion < 2 /*
|
|
69078
|
+
if (languageVersion < 2 /* SpreadElements */) {
|
|
69045
69079
|
checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
|
|
69046
69080
|
}
|
|
69047
69081
|
const spreadType = checkExpression(e.expression, checkMode, forceTuple);
|
|
@@ -69271,7 +69305,7 @@ function createTypeChecker(host) {
|
|
|
69271
69305
|
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
|
|
69272
69306
|
}
|
|
69273
69307
|
} else if (memberDecl.kind === 305 /* SpreadAssignment */) {
|
|
69274
|
-
if (languageVersion < 2 /*
|
|
69308
|
+
if (languageVersion < 2 /* ObjectAssign */) {
|
|
69275
69309
|
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
|
|
69276
69310
|
}
|
|
69277
69311
|
if (propertiesArray.length > 0) {
|
|
@@ -70296,7 +70330,7 @@ function createTypeChecker(host) {
|
|
|
70296
70330
|
const isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType;
|
|
70297
70331
|
let prop;
|
|
70298
70332
|
if (isPrivateIdentifier(right)) {
|
|
70299
|
-
if (languageVersion < 99 /*
|
|
70333
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
70300
70334
|
if (assignmentKind !== 0 /* None */) {
|
|
70301
70335
|
checkExternalEmitHelpers(node, 1048576 /* ClassPrivateFieldSet */);
|
|
70302
70336
|
}
|
|
@@ -72123,7 +72157,7 @@ function createTypeChecker(host) {
|
|
|
72123
72157
|
}
|
|
72124
72158
|
return resolveErrorCall(node);
|
|
72125
72159
|
}
|
|
72126
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
72160
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
72127
72161
|
skippedGenericFunction(node, checkMode);
|
|
72128
72162
|
return resolvingSignature;
|
|
72129
72163
|
}
|
|
@@ -72133,12 +72167,8 @@ function createTypeChecker(host) {
|
|
|
72133
72167
|
}
|
|
72134
72168
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
72135
72169
|
}
|
|
72136
|
-
function
|
|
72137
|
-
|
|
72138
|
-
return false;
|
|
72139
|
-
}
|
|
72140
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
72141
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
72170
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
72171
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
72142
72172
|
}
|
|
72143
72173
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
72144
72174
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -72909,7 +72939,7 @@ function createTypeChecker(host) {
|
|
|
72909
72939
|
function checkTaggedTemplateExpression(node) {
|
|
72910
72940
|
if (!checkGrammarTaggedTemplateChain(node))
|
|
72911
72941
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
72912
|
-
if (languageVersion < 2 /*
|
|
72942
|
+
if (languageVersion < 2 /* TaggedTemplates */) {
|
|
72913
72943
|
checkExternalEmitHelpers(node, 262144 /* MakeTemplateObject */);
|
|
72914
72944
|
}
|
|
72915
72945
|
const signature = getResolvedSignature(node);
|
|
@@ -74556,7 +74586,7 @@ function createTypeChecker(host) {
|
|
|
74556
74586
|
return silentNeverType;
|
|
74557
74587
|
}
|
|
74558
74588
|
if (isPrivateIdentifier(left)) {
|
|
74559
|
-
if (languageVersion < 99 /*
|
|
74589
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
74560
74590
|
checkExternalEmitHelpers(left, 2097152 /* ClassPrivateFieldIn */);
|
|
74561
74591
|
}
|
|
74562
74592
|
if (!getNodeLinks(left).resolvedSymbol && getContainingClass(left)) {
|
|
@@ -74617,7 +74647,7 @@ function createTypeChecker(host) {
|
|
|
74617
74647
|
if (propertyIndex < properties.length - 1) {
|
|
74618
74648
|
error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
74619
74649
|
} else {
|
|
74620
|
-
if (languageVersion <
|
|
74650
|
+
if (languageVersion < 5 /* ObjectSpreadRest */) {
|
|
74621
74651
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
74622
74652
|
}
|
|
74623
74653
|
const nonRestNames = [];
|
|
@@ -74638,7 +74668,7 @@ function createTypeChecker(host) {
|
|
|
74638
74668
|
}
|
|
74639
74669
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
74640
74670
|
const elements = node.elements;
|
|
74641
|
-
if (languageVersion < 2 /*
|
|
74671
|
+
if (languageVersion < 2 /* DestructuringAssignment */ && compilerOptions.downlevelIteration) {
|
|
74642
74672
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
74643
74673
|
}
|
|
74644
74674
|
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
|
|
@@ -75340,10 +75370,10 @@ function createTypeChecker(host) {
|
|
|
75340
75370
|
}
|
|
75341
75371
|
const isAsync = (functionFlags & 2 /* Async */) !== 0;
|
|
75342
75372
|
if (node.asteriskToken) {
|
|
75343
|
-
if (isAsync && languageVersion <
|
|
75373
|
+
if (isAsync && languageVersion < 5 /* AsyncGenerators */) {
|
|
75344
75374
|
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
|
|
75345
75375
|
}
|
|
75346
|
-
if (!isAsync && languageVersion < 2 /*
|
|
75376
|
+
if (!isAsync && languageVersion < 2 /* Generators */ && compilerOptions.downlevelIteration) {
|
|
75347
75377
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
75348
75378
|
}
|
|
75349
75379
|
}
|
|
@@ -76115,13 +76145,13 @@ function createTypeChecker(host) {
|
|
|
76115
76145
|
}
|
|
76116
76146
|
const functionFlags = getFunctionFlags(node);
|
|
76117
76147
|
if (!(functionFlags & 4 /* Invalid */)) {
|
|
76118
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion <
|
|
76148
|
+
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 5 /* AsyncGenerators */) {
|
|
76119
76149
|
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
|
|
76120
76150
|
}
|
|
76121
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /*
|
|
76151
|
+
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* AsyncFunctions */) {
|
|
76122
76152
|
checkExternalEmitHelpers(node, 64 /* Awaiter */);
|
|
76123
76153
|
}
|
|
76124
|
-
if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /*
|
|
76154
|
+
if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /* Generators */) {
|
|
76125
76155
|
checkExternalEmitHelpers(node, 128 /* Generator */);
|
|
76126
76156
|
}
|
|
76127
76157
|
}
|
|
@@ -76354,15 +76384,17 @@ function createTypeChecker(host) {
|
|
|
76354
76384
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
76355
76385
|
}
|
|
76356
76386
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
76357
|
-
if (isPrivateIdentifier(node.name)
|
|
76358
|
-
|
|
76359
|
-
|
|
76360
|
-
|
|
76361
|
-
|
|
76362
|
-
|
|
76363
|
-
|
|
76364
|
-
|
|
76365
|
-
|
|
76387
|
+
if (isPrivateIdentifier(node.name)) {
|
|
76388
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
76389
|
+
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
76390
|
+
getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
|
|
76391
|
+
}
|
|
76392
|
+
if (isClassExpression(node.parent)) {
|
|
76393
|
+
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
76394
|
+
if (enclosingIterationStatement) {
|
|
76395
|
+
getNodeLinks(node.name).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
76396
|
+
getNodeLinks(enclosingIterationStatement).flags |= 4096 /* LoopWithCapturedBlockScopedBinding */;
|
|
76397
|
+
}
|
|
76366
76398
|
}
|
|
76367
76399
|
}
|
|
76368
76400
|
}
|
|
@@ -77314,7 +77346,56 @@ function createTypeChecker(host) {
|
|
|
77314
77346
|
}
|
|
77315
77347
|
}
|
|
77316
77348
|
}
|
|
77349
|
+
function checkGrammarDecorator(decorator) {
|
|
77350
|
+
const sourceFile = getSourceFileOfNode(decorator);
|
|
77351
|
+
if (!hasParseDiagnostics(sourceFile)) {
|
|
77352
|
+
let node = decorator.expression;
|
|
77353
|
+
if (isParenthesizedExpression(node)) {
|
|
77354
|
+
return false;
|
|
77355
|
+
}
|
|
77356
|
+
let canHaveCallExpression = true;
|
|
77357
|
+
let errorNode;
|
|
77358
|
+
while (true) {
|
|
77359
|
+
if (isExpressionWithTypeArguments(node) || isNonNullExpression(node)) {
|
|
77360
|
+
node = node.expression;
|
|
77361
|
+
continue;
|
|
77362
|
+
}
|
|
77363
|
+
if (isCallExpression(node)) {
|
|
77364
|
+
if (!canHaveCallExpression) {
|
|
77365
|
+
errorNode = node;
|
|
77366
|
+
}
|
|
77367
|
+
if (node.questionDotToken) {
|
|
77368
|
+
errorNode = node.questionDotToken;
|
|
77369
|
+
}
|
|
77370
|
+
node = node.expression;
|
|
77371
|
+
canHaveCallExpression = false;
|
|
77372
|
+
continue;
|
|
77373
|
+
}
|
|
77374
|
+
if (isPropertyAccessExpression(node)) {
|
|
77375
|
+
if (node.questionDotToken) {
|
|
77376
|
+
errorNode = node.questionDotToken;
|
|
77377
|
+
}
|
|
77378
|
+
node = node.expression;
|
|
77379
|
+
canHaveCallExpression = false;
|
|
77380
|
+
continue;
|
|
77381
|
+
}
|
|
77382
|
+
if (!isIdentifier(node)) {
|
|
77383
|
+
errorNode = node;
|
|
77384
|
+
}
|
|
77385
|
+
break;
|
|
77386
|
+
}
|
|
77387
|
+
if (errorNode) {
|
|
77388
|
+
addRelatedInfo(
|
|
77389
|
+
error(decorator.expression, Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator),
|
|
77390
|
+
createDiagnosticForNode(errorNode, Diagnostics.Invalid_syntax_in_decorator)
|
|
77391
|
+
);
|
|
77392
|
+
return true;
|
|
77393
|
+
}
|
|
77394
|
+
}
|
|
77395
|
+
return false;
|
|
77396
|
+
}
|
|
77317
77397
|
function checkDecorator(node) {
|
|
77398
|
+
checkGrammarDecorator(node);
|
|
77318
77399
|
const signature = getResolvedSignature(node);
|
|
77319
77400
|
checkDeprecatedSignature(signature, node);
|
|
77320
77401
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -77487,7 +77568,7 @@ function createTypeChecker(host) {
|
|
|
77487
77568
|
if (node.kind === 169 /* Parameter */) {
|
|
77488
77569
|
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
|
|
77489
77570
|
}
|
|
77490
|
-
} else if (languageVersion < 99 /*
|
|
77571
|
+
} else if (languageVersion < 99 /* ClassAndClassElementDecorators */) {
|
|
77491
77572
|
checkExternalEmitHelpers(firstDecorator, 8 /* ESDecorateAndRunInitializers */);
|
|
77492
77573
|
if (isClassDeclaration(node)) {
|
|
77493
77574
|
if (!node.name) {
|
|
@@ -78192,7 +78273,7 @@ function createTypeChecker(host) {
|
|
|
78192
78273
|
potentialUnusedRenamedBindingElementsInTypes.push(node);
|
|
78193
78274
|
return;
|
|
78194
78275
|
}
|
|
78195
|
-
if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /*
|
|
78276
|
+
if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ObjectSpreadRest */) {
|
|
78196
78277
|
checkExternalEmitHelpers(node, 4 /* Rest */);
|
|
78197
78278
|
}
|
|
78198
78279
|
if (node.propertyName && node.propertyName.kind === 167 /* ComputedPropertyName */) {
|
|
@@ -78228,7 +78309,7 @@ function createTypeChecker(host) {
|
|
|
78228
78309
|
}
|
|
78229
78310
|
}
|
|
78230
78311
|
if (isBindingPattern(node.name)) {
|
|
78231
|
-
if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /*
|
|
78312
|
+
if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /* BindingPatterns */ && compilerOptions.downlevelIteration) {
|
|
78232
78313
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
78233
78314
|
}
|
|
78234
78315
|
forEach(node.name.elements, checkSourceElement);
|
|
@@ -78379,7 +78460,7 @@ function createTypeChecker(host) {
|
|
|
78379
78460
|
}
|
|
78380
78461
|
function checkVariableDeclarationList(node) {
|
|
78381
78462
|
const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
|
|
78382
|
-
if (blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) {
|
|
78463
|
+
if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < 99 /* UsingAndAwaitUsing */) {
|
|
78383
78464
|
checkExternalEmitHelpers(node, 16777216 /* AddDisposableResourceAndDisposeResources */);
|
|
78384
78465
|
}
|
|
78385
78466
|
forEach(node.declarations, checkSourceElement);
|
|
@@ -78552,11 +78633,11 @@ function createTypeChecker(host) {
|
|
|
78552
78633
|
grammarErrorOnNode(node.awaitModifier, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block);
|
|
78553
78634
|
} else {
|
|
78554
78635
|
const functionFlags = getFunctionFlags(container);
|
|
78555
|
-
if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion <
|
|
78636
|
+
if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 5 /* ForAwaitOf */) {
|
|
78556
78637
|
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
|
|
78557
78638
|
}
|
|
78558
78639
|
}
|
|
78559
|
-
} else if (compilerOptions.downlevelIteration && languageVersion < 2 /*
|
|
78640
|
+
} else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ForOf */) {
|
|
78560
78641
|
checkExternalEmitHelpers(node, 256 /* ForOfIncludes */);
|
|
78561
78642
|
}
|
|
78562
78643
|
if (node.initializer.kind === 261 /* VariableDeclarationList */) {
|
|
@@ -79480,6 +79561,7 @@ function createTypeChecker(host) {
|
|
|
79480
79561
|
case "symbol":
|
|
79481
79562
|
case "void":
|
|
79482
79563
|
case "object":
|
|
79564
|
+
case "undefined":
|
|
79483
79565
|
error(name, message, name.escapedText);
|
|
79484
79566
|
}
|
|
79485
79567
|
}
|
|
@@ -79619,12 +79701,12 @@ function createTypeChecker(host) {
|
|
|
79619
79701
|
return true;
|
|
79620
79702
|
}
|
|
79621
79703
|
function getFirstTransformableStaticClassElement(node) {
|
|
79622
|
-
const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /*
|
|
79704
|
+
const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */ && classOrConstructorParameterIsDecorated(
|
|
79623
79705
|
/*useLegacyDecorators*/
|
|
79624
79706
|
false,
|
|
79625
79707
|
node
|
|
79626
79708
|
);
|
|
79627
|
-
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion
|
|
79709
|
+
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */;
|
|
79628
79710
|
const willTransformInitializers = !emitStandardClassFields;
|
|
79629
79711
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
79630
79712
|
for (const member of node.members) {
|
|
@@ -79653,7 +79735,7 @@ function createTypeChecker(host) {
|
|
|
79653
79735
|
const parent = walkUpOuterExpressions(node);
|
|
79654
79736
|
if (!isNamedEvaluationSource(parent))
|
|
79655
79737
|
return;
|
|
79656
|
-
const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /*
|
|
79738
|
+
const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */;
|
|
79657
79739
|
let location;
|
|
79658
79740
|
if (willTransformESDecorators && classOrConstructorParameterIsDecorated(
|
|
79659
79741
|
/*useLegacyDecorators*/
|
|
@@ -79713,7 +79795,7 @@ function createTypeChecker(host) {
|
|
|
79713
79795
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
79714
79796
|
if (baseTypeNode) {
|
|
79715
79797
|
forEach(baseTypeNode.typeArguments, checkSourceElement);
|
|
79716
|
-
if (languageVersion < 2 /*
|
|
79798
|
+
if (languageVersion < 2 /* Classes */) {
|
|
79717
79799
|
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
|
|
79718
79800
|
}
|
|
79719
79801
|
const extendsNode = getClassExtendsHeritageElement(node);
|
|
@@ -83182,7 +83264,7 @@ function createTypeChecker(host) {
|
|
|
83182
83264
|
}
|
|
83183
83265
|
}
|
|
83184
83266
|
}
|
|
83185
|
-
|
|
83267
|
+
addUndefinedToGlobalsOrErrorOnRedeclaration();
|
|
83186
83268
|
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
|
|
83187
83269
|
getSymbolLinks(argumentsSymbol).type = getGlobalType(
|
|
83188
83270
|
"IArguments",
|
|
@@ -83836,7 +83918,7 @@ function createTypeChecker(host) {
|
|
|
83836
83918
|
if (parameter.initializer) {
|
|
83837
83919
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
83838
83920
|
}
|
|
83839
|
-
} else if (
|
|
83921
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
83840
83922
|
seenOptionalParameter = true;
|
|
83841
83923
|
if (parameter.questionToken && parameter.initializer) {
|
|
83842
83924
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
|
@@ -86770,12 +86852,12 @@ function getOriginalNodeId(node) {
|
|
|
86770
86852
|
function containsDefaultReference(node) {
|
|
86771
86853
|
if (!node)
|
|
86772
86854
|
return false;
|
|
86773
|
-
if (!isNamedImports(node))
|
|
86855
|
+
if (!isNamedImports(node) && !isNamedExports(node))
|
|
86774
86856
|
return false;
|
|
86775
86857
|
return some(node.elements, isNamedDefaultReference);
|
|
86776
86858
|
}
|
|
86777
86859
|
function isNamedDefaultReference(e) {
|
|
86778
|
-
return e.propertyName !== void 0
|
|
86860
|
+
return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
|
|
86779
86861
|
}
|
|
86780
86862
|
function chainBundle(context, transformSourceFile) {
|
|
86781
86863
|
return transformSourceFileOrBundle;
|
|
@@ -86849,6 +86931,7 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
86849
86931
|
externalImports.push(node);
|
|
86850
86932
|
if (isNamedExports(node.exportClause)) {
|
|
86851
86933
|
addExportedNamesForExportDeclaration(node);
|
|
86934
|
+
hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
|
|
86852
86935
|
} else {
|
|
86853
86936
|
const name = node.exportClause.name;
|
|
86854
86937
|
if (!uniqueExports.get(idText(name))) {
|