typescript 4.5.0-dev.20211025 → 4.5.0-dev.20211029

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.
@@ -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.20211025";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20211029";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -2540,6 +2540,10 @@ var ts;
2540
2540
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
2541
2541
  }
2542
2542
  Debug.formatSyntaxKind = formatSyntaxKind;
2543
+ function formatSnippetKind(kind) {
2544
+ return formatEnum(kind, ts.SnippetKind, /*isFlags*/ false);
2545
+ }
2546
+ Debug.formatSnippetKind = formatSnippetKind;
2543
2547
  function formatNodeFlags(flags) {
2544
2548
  return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
2545
2549
  }
@@ -4456,6 +4460,13 @@ var ts;
4456
4460
  ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
4457
4461
  })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
4458
4462
  /* @internal */
4463
+ var MemberOverrideStatus;
4464
+ (function (MemberOverrideStatus) {
4465
+ MemberOverrideStatus[MemberOverrideStatus["Ok"] = 0] = "Ok";
4466
+ MemberOverrideStatus[MemberOverrideStatus["NeedsOverride"] = 1] = "NeedsOverride";
4467
+ MemberOverrideStatus[MemberOverrideStatus["HasInvalidOverride"] = 2] = "HasInvalidOverride";
4468
+ })(MemberOverrideStatus = ts.MemberOverrideStatus || (ts.MemberOverrideStatus = {}));
4469
+ /* @internal */
4459
4470
  var UnionReduction;
4460
4471
  (function (UnionReduction) {
4461
4472
  UnionReduction[UnionReduction["None"] = 0] = "None";
@@ -5437,6 +5448,15 @@ var ts;
5437
5448
  // Masks
5438
5449
  // - Additional bitmasks
5439
5450
  })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
5451
+ // Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
5452
+ /* @internal */
5453
+ var SnippetKind;
5454
+ (function (SnippetKind) {
5455
+ SnippetKind[SnippetKind["TabStop"] = 0] = "TabStop";
5456
+ SnippetKind[SnippetKind["Placeholder"] = 1] = "Placeholder";
5457
+ SnippetKind[SnippetKind["Choice"] = 2] = "Choice";
5458
+ SnippetKind[SnippetKind["Variable"] = 3] = "Variable";
5459
+ })(SnippetKind = ts.SnippetKind || (ts.SnippetKind = {}));
5440
5460
  var EmitFlags;
5441
5461
  (function (EmitFlags) {
5442
5462
  EmitFlags[EmitFlags["None"] = 0] = "None";
@@ -9332,6 +9352,7 @@ var ts;
9332
9352
  This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
9333
9353
  This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
9334
9354
  A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
9355
+ JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
9335
9356
  You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
9336
9357
  You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
9337
9358
  import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
@@ -19628,6 +19649,8 @@ var ts;
19628
19649
  case ts.ModuleKind.ES2020:
19629
19650
  case ts.ModuleKind.ES2022:
19630
19651
  case ts.ModuleKind.ESNext:
19652
+ case ts.ModuleKind.Node12:
19653
+ case ts.ModuleKind.NodeNext:
19631
19654
  return true;
19632
19655
  default:
19633
19656
  return false;
@@ -20739,6 +20762,10 @@ var ts;
20739
20762
  return node.kind === 212 /* FunctionExpression */ || node.kind === 213 /* ArrowFunction */;
20740
20763
  }
20741
20764
  ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
20765
+ function escapeSnippetText(text) {
20766
+ return text.replace(/\$/gm, "\\$");
20767
+ }
20768
+ ts.escapeSnippetText = escapeSnippetText;
20742
20769
  })(ts || (ts = {}));
20743
20770
  /* @internal */
20744
20771
  var ts;
@@ -26942,6 +26969,25 @@ var ts;
26942
26969
  }
26943
26970
  }
26944
26971
  ts.moveEmitHelpers = moveEmitHelpers;
26972
+ /**
26973
+ * Gets the SnippetElement of a node.
26974
+ */
26975
+ /* @internal */
26976
+ function getSnippetElement(node) {
26977
+ var _a;
26978
+ return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
26979
+ }
26980
+ ts.getSnippetElement = getSnippetElement;
26981
+ /**
26982
+ * Sets the SnippetElement of a node.
26983
+ */
26984
+ /* @internal */
26985
+ function setSnippetElement(node, snippet) {
26986
+ var emitNode = getOrCreateEmitNode(node);
26987
+ emitNode.snippetElement = snippet;
26988
+ return node;
26989
+ }
26990
+ ts.setSnippetElement = setSnippetElement;
26945
26991
  /* @internal */
26946
26992
  function ignoreSourceNewlines(node) {
26947
26993
  getOrCreateEmitNode(node).flags |= 134217728 /* IgnoreSourceNewlines */;
@@ -47067,6 +47113,7 @@ var ts;
47067
47113
  isDeclarationVisible: isDeclarationVisible,
47068
47114
  isPropertyAccessible: isPropertyAccessible,
47069
47115
  getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
47116
+ getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
47070
47117
  };
47071
47118
  function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
47072
47119
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -48813,6 +48860,10 @@ var ts;
48813
48860
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
48814
48861
  return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
48815
48862
  }
48863
+ function isOnlyImportedAsDefault(usage) {
48864
+ var usageMode = getUsageModeForExpression(usage);
48865
+ return usageMode === ts.ModuleKind.ESNext && ts.endsWith(usage.text, ".json" /* Json */);
48866
+ }
48816
48867
  function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
48817
48868
  var usageMode = file && getUsageModeForExpression(usage);
48818
48869
  if (file && usageMode !== undefined) {
@@ -48863,8 +48914,9 @@ var ts;
48863
48914
  exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias);
48864
48915
  }
48865
48916
  var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
48917
+ var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
48866
48918
  var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
48867
- if (!exportDefaultSymbol && !hasSyntheticDefault) {
48919
+ if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
48868
48920
  if (hasExportAssignmentSymbol(moduleSymbol)) {
48869
48921
  var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
48870
48922
  var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
@@ -48878,7 +48930,7 @@ var ts;
48878
48930
  reportNonDefaultExport(moduleSymbol, node);
48879
48931
  }
48880
48932
  }
48881
- else if (hasSyntheticDefault) {
48933
+ else if (hasSyntheticDefault || hasDefaultOnly) {
48882
48934
  // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
48883
48935
  var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
48884
48936
  markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
@@ -49003,7 +49055,7 @@ var ts;
49003
49055
  var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
49004
49056
  if (symbolFromModule === undefined && name.escapedText === "default" /* Default */) {
49005
49057
  var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
49006
- if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
49058
+ if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
49007
49059
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
49008
49060
  }
49009
49061
  }
@@ -49397,21 +49449,28 @@ var ts;
49397
49449
  var namespaceName = getFullyQualifiedName(namespace);
49398
49450
  var declarationName = ts.declarationNameToString(right);
49399
49451
  var suggestionForNonexistentModule = getSuggestedSymbolForNonexistentModule(right, namespace);
49400
- var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49401
- var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49402
- var canSuggestTypeof = containingQualifiedName && !ts.isTypeOfExpression(containingQualifiedName.parent) && tryGetQualifiedNameAsValue(containingQualifiedName);
49403
49452
  if (suggestionForNonexistentModule) {
49404
49453
  error(right, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
49454
+ return undefined;
49405
49455
  }
49406
- else if (canSuggestTypeof) {
49456
+ var containingQualifiedName = ts.isQualifiedName(name) && getContainingQualifiedNameNode(name);
49457
+ var canSuggestTypeof = globalObjectType // <-- can't pull on types if global types aren't initialized yet
49458
+ && (meaning & 788968 /* Type */)
49459
+ && containingQualifiedName
49460
+ && !ts.isTypeOfExpression(containingQualifiedName.parent)
49461
+ && tryGetQualifiedNameAsValue(containingQualifiedName);
49462
+ if (canSuggestTypeof) {
49407
49463
  error(containingQualifiedName, ts.Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, ts.entityNameToString(containingQualifiedName));
49464
+ return undefined;
49408
49465
  }
49409
- else if (meaning & 1920 /* Namespace */ && exportedTypeSymbol && ts.isQualifiedName(name.parent)) {
49410
- error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49411
- }
49412
- else {
49413
- error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49466
+ if (meaning & 1920 /* Namespace */ && ts.isQualifiedName(name.parent)) {
49467
+ var exportedTypeSymbol = getMergedSymbol(getSymbol(getExportsOfSymbol(namespace), right.escapedText, 788968 /* Type */));
49468
+ if (exportedTypeSymbol) {
49469
+ error(name.parent.right, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, symbolToString(exportedTypeSymbol), ts.unescapeLeadingUnderscores(name.parent.right.escapedText));
49470
+ return undefined;
49471
+ }
49414
49472
  }
49473
+ error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, namespaceName, declarationName);
49415
49474
  }
49416
49475
  return undefined;
49417
49476
  }
@@ -49547,6 +49606,9 @@ var ts;
49547
49606
  if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
49548
49607
  error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
49549
49608
  }
49609
+ if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
49610
+ error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
49611
+ }
49550
49612
  }
49551
49613
  // merged symbol is module declaration symbol combined with all augmentations
49552
49614
  return getMergedSymbol(sourceFile.symbol);
@@ -49685,40 +49747,50 @@ var ts;
49685
49747
  error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
49686
49748
  return symbol;
49687
49749
  }
49688
- if (ts.getESModuleInterop(compilerOptions)) {
49689
- var referenceParent = referencingLocation.parent;
49690
- if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
49691
- ts.isImportCall(referenceParent)) {
49692
- var type = getTypeOfSymbol(symbol);
49750
+ var referenceParent = referencingLocation.parent;
49751
+ if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
49752
+ ts.isImportCall(referenceParent)) {
49753
+ var reference = ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier;
49754
+ var type = getTypeOfSymbol(symbol);
49755
+ var defaultOnlyType = getTypeWithSyntheticDefaultOnly(type, symbol, moduleSymbol, reference);
49756
+ if (defaultOnlyType) {
49757
+ return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
49758
+ }
49759
+ if (ts.getESModuleInterop(compilerOptions)) {
49693
49760
  var sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
49694
49761
  if (!sigs || !sigs.length) {
49695
49762
  sigs = getSignaturesOfStructuredType(type, 1 /* Construct */);
49696
49763
  }
49697
- if (sigs && sigs.length) {
49698
- var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier);
49699
- // Create a new symbol which has the module's type less the call and construct signatures
49700
- var result = createSymbol(symbol.flags, symbol.escapedName);
49701
- result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
49702
- result.parent = symbol.parent;
49703
- result.target = symbol;
49704
- result.originatingImport = referenceParent;
49705
- if (symbol.valueDeclaration)
49706
- result.valueDeclaration = symbol.valueDeclaration;
49707
- if (symbol.constEnumOnlyModule)
49708
- result.constEnumOnlyModule = true;
49709
- if (symbol.members)
49710
- result.members = new ts.Map(symbol.members);
49711
- if (symbol.exports)
49712
- result.exports = new ts.Map(symbol.exports);
49713
- var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
49714
- result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
49715
- return result;
49764
+ if ((sigs && sigs.length) || getPropertyOfType(type, "default" /* Default */)) {
49765
+ var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference);
49766
+ return cloneTypeAsModuleType(symbol, moduleType, referenceParent);
49716
49767
  }
49717
49768
  }
49718
49769
  }
49719
49770
  }
49720
49771
  return symbol;
49721
49772
  }
49773
+ /**
49774
+ * Create a new symbol which has the module's type less the call and construct signatures
49775
+ */
49776
+ function cloneTypeAsModuleType(symbol, moduleType, referenceParent) {
49777
+ var result = createSymbol(symbol.flags, symbol.escapedName);
49778
+ result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
49779
+ result.parent = symbol.parent;
49780
+ result.target = symbol;
49781
+ result.originatingImport = referenceParent;
49782
+ if (symbol.valueDeclaration)
49783
+ result.valueDeclaration = symbol.valueDeclaration;
49784
+ if (symbol.constEnumOnlyModule)
49785
+ result.constEnumOnlyModule = true;
49786
+ if (symbol.members)
49787
+ result.members = new ts.Map(symbol.members);
49788
+ if (symbol.exports)
49789
+ result.exports = new ts.Map(symbol.exports);
49790
+ var resolvedModuleType = resolveStructuredTypeMembers(moduleType); // Should already be resolved from the signature checks above
49791
+ result.type = createAnonymousType(result, resolvedModuleType.members, ts.emptyArray, ts.emptyArray, resolvedModuleType.indexInfos);
49792
+ return result;
49793
+ }
49722
49794
  function hasExportAssignmentSymbol(moduleSymbol) {
49723
49795
  return moduleSymbol.exports.get("export=" /* ExportEquals */) !== undefined;
49724
49796
  }
@@ -59324,7 +59396,7 @@ var ts;
59324
59396
  var _loop_16 = function () {
59325
59397
  i--;
59326
59398
  var t = types[i];
59327
- if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeSubtypeOf(t, template); })) {
59399
+ if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
59328
59400
  ts.orderedRemoveItemAt(types, i);
59329
59401
  }
59330
59402
  };
@@ -61517,7 +61589,8 @@ var ts;
61517
61589
  return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
61518
61590
  if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
61519
61591
  if (!type.declaration.nameType) {
61520
- if (isArrayType(t)) {
61592
+ var constraint = void 0;
61593
+ if (isArrayType(t) || (t.flags & 1 /* Any */) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
61521
61594
  return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
61522
61595
  }
61523
61596
  if (isGenericTupleType(t)) {
@@ -63057,13 +63130,12 @@ var ts;
63057
63130
  traceUnionsOrIntersectionsTooLarge(source, target);
63058
63131
  var result = 0 /* False */;
63059
63132
  var saveErrorInfo = captureErrorCalculationState();
63060
- // Note that these checks are specifically ordered to produce correct results. In particular,
63061
- // we need to deconstruct unions before intersections (because unions are always at the top),
63062
- // and we need to handle "each" relations before "some" relations for the same kind of type.
63063
- if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63064
- result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
63065
- recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags) :
63066
- structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63133
+ if ((source.flags & 1048576 /* Union */ || target.flags & 1048576 /* Union */) && getConstituentCount(source) * getConstituentCount(target) < 4) {
63134
+ // We skip caching when source or target is a union with no more than three constituents.
63135
+ result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */);
63136
+ }
63137
+ else if (source.flags & 3145728 /* UnionOrIntersection */ || target.flags & 3145728 /* UnionOrIntersection */) {
63138
+ result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8 /* UnionIntersectionCheck */, recursionFlags);
63067
63139
  }
63068
63140
  if (!result && !(source.flags & 1048576 /* Union */) && (source.flags & (469499904 /* StructuredOrInstantiable */) || target.flags & 469499904 /* StructuredOrInstantiable */)) {
63069
63141
  if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
@@ -63520,19 +63592,19 @@ var ts;
63520
63592
  var maybeStart = maybeCount;
63521
63593
  maybeKeys[maybeCount] = id;
63522
63594
  maybeCount++;
63595
+ var saveExpandingFlags = expandingFlags;
63523
63596
  if (recursionFlags & 1 /* Source */) {
63524
63597
  sourceStack[sourceDepth] = source;
63525
63598
  sourceDepth++;
63599
+ if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63600
+ expandingFlags |= 1 /* Source */;
63526
63601
  }
63527
63602
  if (recursionFlags & 2 /* Target */) {
63528
63603
  targetStack[targetDepth] = target;
63529
63604
  targetDepth++;
63605
+ if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63606
+ expandingFlags |= 2 /* Target */;
63530
63607
  }
63531
- var saveExpandingFlags = expandingFlags;
63532
- if (!(expandingFlags & 1 /* Source */) && isDeeplyNestedType(source, sourceStack, sourceDepth))
63533
- expandingFlags |= 1 /* Source */;
63534
- if (!(expandingFlags & 2 /* Target */) && isDeeplyNestedType(target, targetStack, targetDepth))
63535
- expandingFlags |= 2 /* Target */;
63536
63608
  var originalHandler;
63537
63609
  var propagatingVarianceFlags = 0;
63538
63610
  if (outofbandVarianceMarkerHandler) {
@@ -63556,13 +63628,13 @@ var ts;
63556
63628
  if (outofbandVarianceMarkerHandler) {
63557
63629
  outofbandVarianceMarkerHandler = originalHandler;
63558
63630
  }
63559
- expandingFlags = saveExpandingFlags;
63560
63631
  if (recursionFlags & 1 /* Source */) {
63561
63632
  sourceDepth--;
63562
63633
  }
63563
63634
  if (recursionFlags & 2 /* Target */) {
63564
63635
  targetDepth--;
63565
63636
  }
63637
+ expandingFlags = saveExpandingFlags;
63566
63638
  if (result) {
63567
63639
  if (result === -1 /* True */ || (sourceDepth === 0 && targetDepth === 0)) {
63568
63640
  if (result === -1 /* True */ || result === 3 /* Maybe */) {
@@ -63900,8 +63972,7 @@ var ts;
63900
63972
  // For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
63901
63973
  instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
63902
63974
  }
63903
- var result_9 = inferTypesFromTemplateLiteralType(source, target);
63904
- if (result_9 && ts.every(result_9, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); })) {
63975
+ if (isTypeMatchedByTemplateLiteralType(source, target)) {
63905
63976
  return -1 /* True */;
63906
63977
  }
63907
63978
  }
@@ -64096,9 +64167,9 @@ var ts;
64096
64167
  if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
64097
64168
  var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
64098
64169
  if (objectOnlyTarget.flags & 1048576 /* Union */) {
64099
- var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64100
- if (result_10) {
64101
- return result_10;
64170
+ var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
64171
+ if (result_9) {
64172
+ return result_9;
64102
64173
  }
64103
64174
  }
64104
64175
  }
@@ -64170,13 +64241,13 @@ var ts;
64170
64241
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
64171
64242
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
64172
64243
  if (modifiersRelated) {
64173
- var result_11;
64244
+ var result_10;
64174
64245
  var targetConstraint = getConstraintTypeFromMappedType(target);
64175
64246
  var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
64176
- if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64247
+ if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
64177
64248
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
64178
64249
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
64179
- return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64250
+ return result_10 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
64180
64251
  }
64181
64252
  }
64182
64253
  }
@@ -66259,6 +66330,10 @@ var ts;
66259
66330
  inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) :
66260
66331
  undefined;
66261
66332
  }
66333
+ function isTypeMatchedByTemplateLiteralType(source, target) {
66334
+ var inferences = inferTypesFromTemplateLiteralType(source, target);
66335
+ return !!inferences && ts.every(inferences, function (r, i) { return isValidTypeForTemplateLiteralPlaceholder(r, target.types[i]); });
66336
+ }
66262
66337
  function getStringLikeTypeForType(type) {
66263
66338
  return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]);
66264
66339
  }
@@ -67162,8 +67237,11 @@ var ts;
67162
67237
  function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
67163
67238
  switch (node.kind) {
67164
67239
  case 79 /* Identifier */:
67165
- var symbol = getResolvedSymbol(node);
67166
- return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
67240
+ if (!ts.isThisInTypeQuery(node)) {
67241
+ var symbol = getResolvedSymbol(node);
67242
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + getSymbolId(symbol) : undefined;
67243
+ }
67244
+ // falls through
67167
67245
  case 108 /* ThisKeyword */:
67168
67246
  return "0|" + (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType);
67169
67247
  case 229 /* NonNullExpression */:
@@ -67794,7 +67872,7 @@ var ts;
67794
67872
  mapType(type, mapper);
67795
67873
  }
67796
67874
  function getConstituentCount(type) {
67797
- return type.flags & 3145728 /* UnionOrIntersection */ ? type.types.length : 1;
67875
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
67798
67876
  }
67799
67877
  function extractTypesOfKind(type, kind) {
67800
67878
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -69292,7 +69370,7 @@ var ts;
69292
69370
  return parent.kind === 205 /* PropertyAccessExpression */ ||
69293
69371
  parent.kind === 207 /* CallExpression */ && parent.expression === node ||
69294
69372
  parent.kind === 206 /* ElementAccessExpression */ && parent.expression === node &&
69295
- !(isGenericTypeWithoutNullableConstraint(type) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69373
+ !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
69296
69374
  }
69297
69375
  function isGenericTypeWithUnionConstraint(type) {
69298
69376
  return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
@@ -74892,11 +74970,33 @@ var ts;
74892
74970
  if (moduleSymbol) {
74893
74971
  var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true, /*suppressUsageError*/ false);
74894
74972
  if (esModuleSymbol) {
74895
- return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
74973
+ return createPromiseReturnType(node, getTypeWithSyntheticDefaultOnly(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier) ||
74974
+ getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
74896
74975
  }
74897
74976
  }
74898
74977
  return createPromiseReturnType(node, anyType);
74899
74978
  }
74979
+ function createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol) {
74980
+ var memberTable = ts.createSymbolTable();
74981
+ var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
74982
+ newSymbol.parent = originalSymbol;
74983
+ newSymbol.nameType = getStringLiteralType("default");
74984
+ newSymbol.target = resolveSymbol(symbol);
74985
+ memberTable.set("default" /* Default */, newSymbol);
74986
+ return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
74987
+ }
74988
+ function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
74989
+ var hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
74990
+ if (hasDefaultOnly && type && !isErrorType(type)) {
74991
+ var synthType = type;
74992
+ if (!synthType.defaultOnlyType) {
74993
+ var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
74994
+ synthType.defaultOnlyType = type_4;
74995
+ }
74996
+ return synthType.defaultOnlyType;
74997
+ }
74998
+ return undefined;
74999
+ }
74900
75000
  function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
74901
75001
  var _a;
74902
75002
  if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
@@ -74905,14 +75005,8 @@ var ts;
74905
75005
  var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
74906
75006
  var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
74907
75007
  if (hasSyntheticDefault) {
74908
- var memberTable = ts.createSymbolTable();
74909
- var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
74910
- newSymbol.parent = originalSymbol;
74911
- newSymbol.nameType = getStringLiteralType("default");
74912
- newSymbol.target = resolveSymbol(symbol);
74913
- memberTable.set("default" /* Default */, newSymbol);
74914
75008
  var anonymousSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
74915
- var defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
75009
+ var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
74916
75010
  anonymousSymbol.type = defaultContainingObject;
74917
75011
  synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
74918
75012
  }
@@ -75620,12 +75714,12 @@ var ts;
75620
75714
  var witnesses = getSwitchClauseTypeOfWitnesses(node, /*retainDefault*/ false);
75621
75715
  // notEqualFacts states that the type of the switched value is not equal to every type in the switch.
75622
75716
  var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, /*hasDefault*/ true);
75623
- var type_4 = getBaseConstraintOfType(operandType) || operandType;
75717
+ var type_5 = getBaseConstraintOfType(operandType) || operandType;
75624
75718
  // Take any/unknown as a special condition. Or maybe we could change `type` to a union containing all primitive types.
75625
- if (type_4.flags & 3 /* AnyOrUnknown */) {
75719
+ if (type_5.flags & 3 /* AnyOrUnknown */) {
75626
75720
  return (556800 /* AllTypeofNE */ & notEqualFacts_1) === 556800 /* AllTypeofNE */;
75627
75721
  }
75628
- return !!(filterType(type_4, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
75722
+ return !!(filterType(type_5, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072 /* Never */);
75629
75723
  }
75630
75724
  var type = getTypeOfExpression(node.expression);
75631
75725
  if (!isLiteralType(type)) {
@@ -78721,12 +78815,12 @@ var ts;
78721
78815
  case 264 /* ImportEqualsDeclaration */:
78722
78816
  case 267 /* NamespaceImport */:
78723
78817
  case 266 /* ImportClause */:
78724
- var result_12 = 0 /* None */;
78818
+ var result_11 = 0 /* None */;
78725
78819
  var target = resolveAlias(getSymbolOfNode(d));
78726
78820
  ts.forEach(target.declarations, function (d) {
78727
- result_12 |= getDeclarationSpaces(d);
78821
+ result_11 |= getDeclarationSpaces(d);
78728
78822
  });
78729
- return result_12;
78823
+ return result_11;
78730
78824
  case 253 /* VariableDeclaration */:
78731
78825
  case 202 /* BindingElement */:
78732
78826
  case 255 /* FunctionDeclaration */:
@@ -81595,7 +81689,7 @@ var ts;
81595
81689
  checkKindsOfPropertyMemberOverrides(type, baseType_1);
81596
81690
  }
81597
81691
  }
81598
- checkMembersForMissingOverrideModifier(node, type, typeWithThis, staticType);
81692
+ checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
81599
81693
  var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
81600
81694
  if (implementedTypeNodes) {
81601
81695
  for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
@@ -81630,8 +81724,7 @@ var ts;
81630
81724
  checkPropertyInitialization(node);
81631
81725
  }
81632
81726
  }
81633
- function checkMembersForMissingOverrideModifier(node, type, typeWithThis, staticType) {
81634
- var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
81727
+ function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
81635
81728
  var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
81636
81729
  var baseTypes = baseTypeNode && getBaseTypes(type);
81637
81730
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
@@ -81643,46 +81736,71 @@ var ts;
81643
81736
  if (ts.isConstructorDeclaration(member)) {
81644
81737
  ts.forEach(member.parameters, function (param) {
81645
81738
  if (ts.isParameterPropertyDeclaration(param, member)) {
81646
- checkClassMember(param, /*memberIsParameterProperty*/ true);
81739
+ checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
81740
+ /* memberIsParameterProperty */ true);
81647
81741
  }
81648
81742
  });
81649
81743
  }
81650
- checkClassMember(member);
81744
+ checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
81745
+ /* memberIsParameterProperty */ false);
81651
81746
  };
81652
81747
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
81653
81748
  var member = _a[_i];
81654
81749
  _loop_29(member);
81655
81750
  }
81656
- function checkClassMember(member, memberIsParameterProperty) {
81657
- var hasOverride = ts.hasOverrideModifier(member);
81658
- var hasStatic = ts.isStatic(member);
81659
- var isJs = ts.isInJSFile(member);
81660
- if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
81661
- var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
81662
- if (!declaredProp) {
81663
- return;
81664
- }
81665
- var thisType = hasStatic ? staticType : typeWithThis;
81666
- var baseType = hasStatic ? baseStaticType : baseWithThis;
81667
- var prop = getPropertyOfType(thisType, declaredProp.escapedName);
81668
- var baseProp = getPropertyOfType(baseType, declaredProp.escapedName);
81669
- var baseClassName = typeToString(baseWithThis);
81670
- if (prop && !baseProp && hasOverride) {
81671
- var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
81751
+ }
81752
+ /**
81753
+ * @param member Existing member node to be checked.
81754
+ * Note: `member` cannot be a synthetic node.
81755
+ */
81756
+ function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
81757
+ if (reportErrors === void 0) { reportErrors = true; }
81758
+ var declaredProp = member.name
81759
+ && getSymbolAtLocation(member.name)
81760
+ || getSymbolAtLocation(member);
81761
+ if (!declaredProp) {
81762
+ return 0 /* Ok */;
81763
+ }
81764
+ return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
81765
+ }
81766
+ /**
81767
+ * Checks a class member declaration for either a missing or an invalid `override` modifier.
81768
+ * Note: this function can be used for speculative checking,
81769
+ * i.e. checking a member that does not yet exist in the program.
81770
+ * An example of that would be to call this function in a completions scenario,
81771
+ * when offering a method declaration as completion.
81772
+ * @param errorNode The node where we should report an error, or undefined if we should not report errors.
81773
+ */
81774
+ function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
81775
+ var isJs = ts.isInJSFile(node);
81776
+ var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
81777
+ if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
81778
+ var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
81779
+ var thisType = memberIsStatic ? staticType : typeWithThis;
81780
+ var baseType = memberIsStatic ? baseStaticType : baseWithThis;
81781
+ var prop = getPropertyOfType(thisType, memberEscapedName);
81782
+ var baseProp = getPropertyOfType(baseType, memberEscapedName);
81783
+ var baseClassName = typeToString(baseWithThis);
81784
+ if (prop && !baseProp && memberHasOverrideModifier) {
81785
+ if (errorNode) {
81786
+ var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); // Again, using symbol name: note that's different from `symbol.escapedName`
81672
81787
  suggestion ?
81673
- error(member, isJs ?
81788
+ error(errorNode, isJs ?
81674
81789
  ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1 :
81675
81790
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
81676
- error(member, isJs ?
81791
+ error(errorNode, isJs ?
81677
81792
  ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
81678
81793
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
81679
81794
  }
81680
- else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
81681
- var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
81682
- if (hasOverride) {
81683
- return;
81684
- }
81685
- if (!baseHasAbstract) {
81795
+ return 2 /* HasInvalidOverride */;
81796
+ }
81797
+ else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
81798
+ var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
81799
+ if (memberHasOverrideModifier) {
81800
+ return 0 /* Ok */;
81801
+ }
81802
+ if (!baseHasAbstract) {
81803
+ if (errorNode) {
81686
81804
  var diag = memberIsParameterProperty ?
81687
81805
  isJs ?
81688
81806
  ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
@@ -81690,20 +81808,28 @@ var ts;
81690
81808
  isJs ?
81691
81809
  ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
81692
81810
  ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
81693
- error(member, diag, baseClassName);
81811
+ error(errorNode, diag, baseClassName);
81694
81812
  }
81695
- else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
81696
- error(member, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
81813
+ return 1 /* NeedsOverride */;
81814
+ }
81815
+ else if (memberHasAbstractModifier && baseHasAbstract) {
81816
+ if (errorNode) {
81817
+ error(errorNode, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
81697
81818
  }
81819
+ return 1 /* NeedsOverride */;
81698
81820
  }
81699
81821
  }
81700
- else if (hasOverride) {
81822
+ }
81823
+ else if (memberHasOverrideModifier) {
81824
+ if (errorNode) {
81701
81825
  var className = typeToString(type);
81702
- error(member, isJs ?
81826
+ error(errorNode, isJs ?
81703
81827
  ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
81704
81828
  ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
81705
81829
  }
81830
+ return 2 /* HasInvalidOverride */;
81706
81831
  }
81832
+ return 0 /* Ok */;
81707
81833
  }
81708
81834
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
81709
81835
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
@@ -81746,6 +81872,31 @@ var ts;
81746
81872
  }
81747
81873
  }
81748
81874
  }
81875
+ /**
81876
+ * Checks a member declaration node to see if has a missing or invalid `override` modifier.
81877
+ * @param node Class-like node where the member is declared.
81878
+ * @param member Member declaration node.
81879
+ * Note: `member` can be a synthetic node without a parent.
81880
+ */
81881
+ function getMemberOverrideModifierStatus(node, member) {
81882
+ if (!member.name) {
81883
+ return 0 /* Ok */;
81884
+ }
81885
+ var symbol = getSymbolOfNode(node);
81886
+ var type = getDeclaredTypeOfSymbol(symbol);
81887
+ var typeWithThis = getTypeWithThisArgument(type);
81888
+ var staticType = getTypeOfSymbol(symbol);
81889
+ var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
81890
+ var baseTypes = baseTypeNode && getBaseTypes(type);
81891
+ var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
81892
+ var baseStaticType = getBaseConstructorTypeOfClass(type);
81893
+ var memberHasOverrideModifier = member.parent
81894
+ ? ts.hasOverrideModifier(member)
81895
+ : ts.hasSyntacticModifier(member, 16384 /* Override */);
81896
+ var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
81897
+ return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member),
81898
+ /* memberIsParameterProperty */ false, memberName);
81899
+ }
81749
81900
  function getTargetSymbol(s) {
81750
81901
  // if symbol is instantiated its flags are not copied from the 'target'
81751
81902
  // so we'll need to get back original 'target' symbol to work with correct set of flags
@@ -94899,8 +95050,8 @@ var ts;
94899
95050
  function convertJsxChildrenToChildrenPropAssignment(children) {
94900
95051
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
94901
95052
  if (ts.length(nonWhitespaceChildren) === 1) {
94902
- var result_13 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
94903
- return result_13 && factory.createPropertyAssignment("children", result_13);
95053
+ var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
95054
+ return result_12 && factory.createPropertyAssignment("children", result_12);
94904
95055
  }
94905
95056
  var result = ts.mapDefined(children, transformJsxChildToExpression);
94906
95057
  return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
@@ -108050,7 +108201,14 @@ var ts;
108050
108201
  // clear the parenthesizer rule as we ascend
108051
108202
  currentParenthesizerRule = undefined;
108052
108203
  }
108053
- function pipelineEmitWithHintWorker(hint, node) {
108204
+ function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
108205
+ if (allowSnippets === void 0) { allowSnippets = true; }
108206
+ if (allowSnippets) {
108207
+ var snippet = ts.getSnippetElement(node);
108208
+ if (snippet) {
108209
+ return emitSnippetNode(hint, node, snippet);
108210
+ }
108211
+ }
108054
108212
  if (hint === 0 /* SourceFile */)
108055
108213
  return emitSourceFile(ts.cast(node, ts.isSourceFile));
108056
108214
  if (hint === 2 /* IdentifierName */)
@@ -108659,6 +108817,28 @@ var ts;
108659
108817
  }
108660
108818
  }
108661
108819
  //
108820
+ // Snippet Elements
108821
+ //
108822
+ function emitSnippetNode(hint, node, snippet) {
108823
+ switch (snippet.kind) {
108824
+ case 1 /* Placeholder */:
108825
+ emitPlaceholder(hint, node, snippet);
108826
+ break;
108827
+ case 0 /* TabStop */:
108828
+ emitTabStop(snippet);
108829
+ break;
108830
+ }
108831
+ }
108832
+ function emitPlaceholder(hint, node, snippet) {
108833
+ nonEscapingWrite("${" + snippet.order + ":"); // `${2:`
108834
+ pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
108835
+ nonEscapingWrite("}"); // `}`
108836
+ // `${2:...}`
108837
+ }
108838
+ function emitTabStop(snippet) {
108839
+ nonEscapingWrite("$" + snippet.order);
108840
+ }
108841
+ //
108662
108842
  // Identifiers
108663
108843
  //
108664
108844
  function emitIdentifier(node) {
@@ -110897,6 +111077,15 @@ var ts;
110897
111077
  function writeProperty(s) {
110898
111078
  writer.writeProperty(s);
110899
111079
  }
111080
+ function nonEscapingWrite(s) {
111081
+ // This should be defined in a snippet-escaping text writer.
111082
+ if (writer.nonEscapingWrite) {
111083
+ writer.nonEscapingWrite(s);
111084
+ }
111085
+ else {
111086
+ writer.write(s);
111087
+ }
111088
+ }
110900
111089
  function writeLine(count) {
110901
111090
  if (count === void 0) { count = 1; }
110902
111091
  for (var i = 0; i < count; i++) {
@@ -113700,15 +113889,15 @@ var ts;
113700
113889
  // which per above occurred during the current program creation.
113701
113890
  // Since we assume the filesystem does not change during program creation,
113702
113891
  // it is safe to reuse resolutions from the earlier call.
113703
- var result_14 = [];
113892
+ var result_13 = [];
113704
113893
  var i = 0;
113705
113894
  for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
113706
113895
  var moduleName = moduleNames_1[_i];
113707
113896
  var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
113708
113897
  i++;
113709
- result_14.push(resolvedModule);
113898
+ result_13.push(resolvedModule);
113710
113899
  }
113711
- return result_14;
113900
+ return result_13;
113712
113901
  }
113713
113902
  // At this point, we know at least one of the following hold:
113714
113903
  // - file has local declarations for ambient modules
@@ -115437,7 +115626,9 @@ var ts;
115437
115626
  }
115438
115627
  }
115439
115628
  if (options.resolveJsonModule) {
115440
- if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) {
115629
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
115630
+ ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 &&
115631
+ ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
115441
115632
  createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
115442
115633
  }
115443
115634
  // Any emit other than common js, amd, es2015 or esnext is error
@@ -118770,9 +118961,9 @@ var ts;
118770
118961
  if (!preferSymlinks) {
118771
118962
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
118772
118963
  // so we only need to remove them from the realpath filenames.
118773
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118774
- if (result_15)
118775
- return result_15;
118964
+ var result_14 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
118965
+ if (result_14)
118966
+ return result_14;
118776
118967
  }
118777
118968
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
118778
118969
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -118792,10 +118983,10 @@ var ts;
118792
118983
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
118793
118984
  var symlinkDirectory = symlinkDirectories_1[_i];
118794
118985
  var option = ts.resolvePath(symlinkDirectory, relative);
118795
- var result_16 = cb(option, target === referenceRedirect);
118986
+ var result_15 = cb(option, target === referenceRedirect);
118796
118987
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
118797
- if (result_16)
118798
- return result_16;
118988
+ if (result_15)
118989
+ return result_15;
118799
118990
  }
118800
118991
  });
118801
118992
  });