typescript 4.7.0-dev.20220227 → 4.7.0-dev.20220302

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.
@@ -18,6 +18,8 @@ and limitations under the License.
18
18
  /// <reference no-default-lib="true"/>
19
19
 
20
20
 
21
+ /// <reference lib="es2020.intl" />
22
+
21
23
  interface BigIntToLocaleStringOptions {
22
24
  /**
23
25
  * The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
@@ -112,7 +114,7 @@ interface BigInt {
112
114
  toString(radix?: number): string;
113
115
 
114
116
  /** Returns a string representation appropriate to the host environment's current locale. */
115
- toLocaleString(locales?: string, options?: BigIntToLocaleStringOptions): string;
117
+ toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string;
116
118
 
117
119
  /** Returns the primitive value of the specified object. */
118
120
  valueOf(): bigint;
@@ -20,6 +20,8 @@ and limitations under the License.
20
20
 
21
21
  /// <reference lib="es2019" />
22
22
  /// <reference lib="es2020.bigint" />
23
+ /// <reference lib="es2020.date" />
24
+ /// <reference lib="es2020.number" />
23
25
  /// <reference lib="es2020.promise" />
24
26
  /// <reference lib="es2020.sharedmemory" />
25
27
  /// <reference lib="es2020.string" />
@@ -0,0 +1,44 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+
18
+ /// <reference no-default-lib="true"/>
19
+
20
+
21
+ /// <reference lib="es2020.intl" />
22
+
23
+ interface Date {
24
+ /**
25
+ * Converts a date and time to a string by using the current or specified locale.
26
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
27
+ * @param options An object that contains one or more properties that specify comparison options.
28
+ */
29
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
30
+
31
+ /**
32
+ * Converts a date to a string by using the current or specified locale.
33
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
34
+ * @param options An object that contains one or more properties that specify comparison options.
35
+ */
36
+ toLocaleDateString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
37
+
38
+ /**
39
+ * Converts a time to a string by using the current or specified locale.
40
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
41
+ * @param options An object that contains one or more properties that specify comparison options.
42
+ */
43
+ toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
44
+ }
@@ -78,6 +78,13 @@ declare namespace Intl {
78
78
  */
79
79
  type BCP47LanguageTag = string;
80
80
 
81
+ /**
82
+ * The locale(s) to use
83
+ *
84
+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
85
+ */
86
+ type LocalesArgument = UnicodeBCP47LocaleIdentifier | UnicodeBCP47LocaleIdentifier[] | Locale | Locale[] | undefined;
87
+
81
88
  /**
82
89
  * An object with some or all of properties of `options` parameter
83
90
  * of `Intl.RelativeTimeFormat` constructor.
@@ -0,0 +1,30 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+
18
+ /// <reference no-default-lib="true"/>
19
+
20
+
21
+ /// <reference lib="es2020.intl" />
22
+
23
+ interface Number {
24
+ /**
25
+ * Converts a number to a string by using the current or specified locale.
26
+ * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
27
+ * @param options An object that contains one or more properties that specify comparison options.
28
+ */
29
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): string;
30
+ }
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.20220227";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -25279,9 +25279,7 @@ var ts;
25279
25279
  return;
25280
25280
  }
25281
25281
  if (initializer) {
25282
- if (token() === 18) {
25283
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25284
- }
25282
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26));
25285
25283
  return;
25286
25284
  }
25287
25285
  parseErrorForMissingSemicolonAfter(name);
@@ -30944,11 +30942,13 @@ var ts;
30944
30942
  ["es2019.string", "lib.es2019.string.d.ts"],
30945
30943
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
30946
30944
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
30945
+ ["es2020.date", "lib.es2020.date.d.ts"],
30947
30946
  ["es2020.promise", "lib.es2020.promise.d.ts"],
30948
30947
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
30949
30948
  ["es2020.string", "lib.es2020.string.d.ts"],
30950
30949
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
30951
30950
  ["es2020.intl", "lib.es2020.intl.d.ts"],
30951
+ ["es2020.number", "lib.es2020.number.d.ts"],
30952
30952
  ["es2021.promise", "lib.es2021.promise.d.ts"],
30953
30953
  ["es2021.string", "lib.es2021.string.d.ts"],
30954
30954
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -45581,8 +45581,8 @@ var ts;
45581
45581
  var memberDeclaration = root.kind === 163 ? root.parent : root;
45582
45582
  return isPrivateWithinAmbient(memberDeclaration);
45583
45583
  }
45584
- function tryGetTypeFromEffectiveTypeNode(declaration) {
45585
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
45584
+ function tryGetTypeFromEffectiveTypeNode(node) {
45585
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
45586
45586
  if (typeNode) {
45587
45587
  return getTypeFromTypeNode(typeNode);
45588
45588
  }
@@ -51786,7 +51786,7 @@ var ts;
51786
51786
  var checkType_1 = root.checkType;
51787
51787
  var distributionType = root.isDistributive ? getMappedType(checkType_1, newMapper_1) : undefined;
51788
51788
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 | 131072) ?
51789
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
51789
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
51790
51790
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
51791
51791
  root.instantiations.set(id, result);
51792
51792
  }
@@ -54127,8 +54127,8 @@ var ts;
54127
54127
  }
54128
54128
  return 0;
54129
54129
  }
54130
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
54131
- !!(sourcePropFlags & 64) && !(targetPropFlags & 64)) {
54130
+ if (relation === strictSubtypeRelation &&
54131
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
54132
54132
  return 0;
54133
54133
  }
54134
54134
  var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState);
@@ -59756,6 +59756,8 @@ var ts;
59756
59756
  }
59757
59757
  case 229:
59758
59758
  return getContextualType(parent, contextFlags);
59759
+ case 270:
59760
+ return tryGetTypeFromEffectiveTypeNode(parent);
59759
59761
  case 287:
59760
59762
  return getContextualTypeForJsxExpression(parent);
59761
59763
  case 284:
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.20220227";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -31377,18 +31377,8 @@ var ts;
31377
31377
  if (tryParseSemicolon()) {
31378
31378
  return;
31379
31379
  }
31380
- // If an initializer was parsed but there is still an error in finding the next semicolon,
31381
- // we generally know there was an error already reported in the initializer...
31382
- // class Example { a = new Map([), ) }
31383
- // ~
31384
31380
  if (initializer) {
31385
- // ...unless we've found the start of a block after a property declaration, in which
31386
- // case we can know that regardless of the initializer we should complain on the block.
31387
- // class Example { a = 0 {} }
31388
- // ~
31389
- if (token() === 18 /* OpenBraceToken */) {
31390
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31391
- }
31381
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31392
31382
  return;
31393
31383
  }
31394
31384
  parseErrorForMissingSemicolonAfter(name);
@@ -38325,11 +38315,13 @@ var ts;
38325
38315
  ["es2019.string", "lib.es2019.string.d.ts"],
38326
38316
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
38327
38317
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
38318
+ ["es2020.date", "lib.es2020.date.d.ts"],
38328
38319
  ["es2020.promise", "lib.es2020.promise.d.ts"],
38329
38320
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
38330
38321
  ["es2020.string", "lib.es2020.string.d.ts"],
38331
38322
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
38332
38323
  ["es2020.intl", "lib.es2020.intl.d.ts"],
38324
+ ["es2020.number", "lib.es2020.number.d.ts"],
38333
38325
  ["es2021.promise", "lib.es2021.promise.d.ts"],
38334
38326
  ["es2021.string", "lib.es2021.string.d.ts"],
38335
38327
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -55263,8 +55255,8 @@ var ts;
55263
55255
  var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
55264
55256
  return isPrivateWithinAmbient(memberDeclaration);
55265
55257
  }
55266
- function tryGetTypeFromEffectiveTypeNode(declaration) {
55267
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
55258
+ function tryGetTypeFromEffectiveTypeNode(node) {
55259
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
55268
55260
  if (typeNode) {
55269
55261
  return getTypeFromTypeNode(typeNode);
55270
55262
  }
@@ -62283,7 +62275,7 @@ var ts;
62283
62275
  // distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
62284
62276
  // result is (A extends U ? X : Y) | (B extends U ? X : Y).
62285
62277
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
62286
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62278
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62287
62279
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
62288
62280
  root.instantiations.set(id, result);
62289
62281
  }
@@ -65026,8 +65018,9 @@ var ts;
65026
65018
  // This ensures the subtype relationship is ordered, and preventing declaration order
65027
65019
  // from deciding which type "wins" in union subtype reduction.
65028
65020
  // They're still assignable to one another, since `readonly` doesn't affect assignability.
65029
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65030
- !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65021
+ // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
65022
+ if (relation === strictSubtypeRelation &&
65023
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
65031
65024
  return 0 /* False */;
65032
65025
  }
65033
65026
  // If the target comes from a partial union prop, allow `undefined` in the target type
@@ -71587,6 +71580,8 @@ var ts;
71587
71580
  }
71588
71581
  case 229 /* NonNullExpression */:
71589
71582
  return getContextualType(parent, contextFlags);
71583
+ case 270 /* ExportAssignment */:
71584
+ return tryGetTypeFromEffectiveTypeNode(parent);
71590
71585
  case 287 /* JsxExpression */:
71591
71586
  return getContextualTypeForJsxExpression(parent);
71592
71587
  case 284 /* JsxAttribute */:
@@ -130118,7 +130113,7 @@ var ts;
130118
130113
  completionKind === 3 /* MemberLike */ &&
130119
130114
  isClassLikeMemberCompletion(symbol, location)) {
130120
130115
  var importAdder = void 0;
130121
- (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
130116
+ (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
130122
130117
  if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
130123
130118
  hasAction = true;
130124
130119
  source = CompletionSource.ClassMemberSnippet;
@@ -130222,6 +130217,7 @@ var ts;
130222
130217
  return { insertText: name };
130223
130218
  }
130224
130219
  var isSnippet;
130220
+ var replacementSpan;
130225
130221
  var insertText = name;
130226
130222
  var checker = program.getTypeChecker();
130227
130223
  var sourceFile = location.getSourceFile();
@@ -130250,10 +130246,8 @@ var ts;
130250
130246
  var modifiers = 0 /* None */;
130251
130247
  // Whether the suggested member should be abstract.
130252
130248
  // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
130253
- // Note: We are relying on checking if the context token is `abstract`,
130254
- // since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
130255
- // However, that is not true for the e.g. `override` modifier, so this check has its limitations.
130256
- var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
130249
+ var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span;
130250
+ var isAbstract = !!(presentModifiers & 128 /* Abstract */);
130257
130251
  var completionNodes = [];
130258
130252
  ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
130259
130253
  // `addNewNodeForMemberSymbol` calls this callback function for each new member node
@@ -130272,22 +130266,18 @@ var ts;
130272
130266
  && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
130273
130267
  requiredModifiers |= 16384 /* Override */;
130274
130268
  }
130275
- var presentModifiers = 0 /* None */;
130276
130269
  if (!completionNodes.length) {
130277
- // Omit already present modifiers from the first completion node/signature.
130278
- if (contextToken) {
130279
- presentModifiers = getPresentModifiers(contextToken);
130280
- }
130281
130270
  // Keep track of added missing required modifiers and modifiers already present.
130282
130271
  // This is needed when we have overloaded signatures,
130283
130272
  // so this callback will be called for multiple nodes/signatures,
130284
130273
  // and we need to make sure the modifiers are uniform for all nodes/signatures.
130285
130274
  modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
130286
130275
  }
130287
- node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
130276
+ node = ts.factory.updateModifiers(node, modifiers);
130288
130277
  completionNodes.push(node);
130289
130278
  }, body, 2 /* Property */, isAbstract);
130290
130279
  if (completionNodes.length) {
130280
+ replacementSpan = modifiersSpan;
130291
130281
  // If we have access to formatting settings, we print the nodes using the emitter,
130292
130282
  // and then format the printed text.
130293
130283
  if (formatContext) {
@@ -130310,10 +130300,14 @@ var ts;
130310
130300
  insertText = printer.printSnippetList(1 /* MultiLine */ | 131072 /* NoTrailingNewLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
130311
130301
  }
130312
130302
  }
130313
- return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
130303
+ return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder, replacementSpan: replacementSpan };
130314
130304
  }
130315
130305
  function getPresentModifiers(contextToken) {
130306
+ if (!contextToken) {
130307
+ return { modifiers: 0 /* None */ };
130308
+ }
130316
130309
  var modifiers = 0 /* None */;
130310
+ var span;
130317
130311
  var contextMod;
130318
130312
  /*
130319
130313
  Cases supported:
@@ -130336,11 +130330,13 @@ var ts;
130336
130330
  */
130337
130331
  if (contextMod = isModifierLike(contextToken)) {
130338
130332
  modifiers |= ts.modifierToFlag(contextMod);
130333
+ span = ts.createTextSpanFromNode(contextToken);
130339
130334
  }
130340
130335
  if (ts.isPropertyDeclaration(contextToken.parent)) {
130341
130336
  modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
130337
+ span = ts.createTextSpanFromNode(contextToken.parent);
130342
130338
  }
130343
- return modifiers;
130339
+ return { modifiers: modifiers, span: span };
130344
130340
  }
130345
130341
  function isModifierLike(node) {
130346
130342
  if (ts.isModifier(node)) {
@@ -160491,7 +160487,7 @@ var ts;
160491
160487
  var isLastSpan = index === currentNode.templateSpans.length - 1;
160492
160488
  var text = span.literal.text + (isLastSpan ? subsequentText : "");
160493
160489
  var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : "");
160494
- return ts.factory.createTemplateSpan(span.expression, isLast
160490
+ return ts.factory.createTemplateSpan(span.expression, isLast && isLastSpan
160495
160491
  ? ts.factory.createTemplateTail(text, rawText)
160496
160492
  : ts.factory.createTemplateMiddle(text, rawText));
160497
160493
  });
@@ -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.20220227";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -31571,18 +31571,8 @@ var ts;
31571
31571
  if (tryParseSemicolon()) {
31572
31572
  return;
31573
31573
  }
31574
- // If an initializer was parsed but there is still an error in finding the next semicolon,
31575
- // we generally know there was an error already reported in the initializer...
31576
- // class Example { a = new Map([), ) }
31577
- // ~
31578
31574
  if (initializer) {
31579
- // ...unless we've found the start of a block after a property declaration, in which
31580
- // case we can know that regardless of the initializer we should complain on the block.
31581
- // class Example { a = 0 {} }
31582
- // ~
31583
- if (token() === 18 /* OpenBraceToken */) {
31584
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31585
- }
31575
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31586
31576
  return;
31587
31577
  }
31588
31578
  parseErrorForMissingSemicolonAfter(name);
@@ -38519,11 +38509,13 @@ var ts;
38519
38509
  ["es2019.string", "lib.es2019.string.d.ts"],
38520
38510
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
38521
38511
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
38512
+ ["es2020.date", "lib.es2020.date.d.ts"],
38522
38513
  ["es2020.promise", "lib.es2020.promise.d.ts"],
38523
38514
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
38524
38515
  ["es2020.string", "lib.es2020.string.d.ts"],
38525
38516
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
38526
38517
  ["es2020.intl", "lib.es2020.intl.d.ts"],
38518
+ ["es2020.number", "lib.es2020.number.d.ts"],
38527
38519
  ["es2021.promise", "lib.es2021.promise.d.ts"],
38528
38520
  ["es2021.string", "lib.es2021.string.d.ts"],
38529
38521
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -55457,8 +55449,8 @@ var ts;
55457
55449
  var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
55458
55450
  return isPrivateWithinAmbient(memberDeclaration);
55459
55451
  }
55460
- function tryGetTypeFromEffectiveTypeNode(declaration) {
55461
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
55452
+ function tryGetTypeFromEffectiveTypeNode(node) {
55453
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
55462
55454
  if (typeNode) {
55463
55455
  return getTypeFromTypeNode(typeNode);
55464
55456
  }
@@ -62477,7 +62469,7 @@ var ts;
62477
62469
  // distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
62478
62470
  // result is (A extends U ? X : Y) | (B extends U ? X : Y).
62479
62471
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
62480
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62472
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62481
62473
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
62482
62474
  root.instantiations.set(id, result);
62483
62475
  }
@@ -65220,8 +65212,9 @@ var ts;
65220
65212
  // This ensures the subtype relationship is ordered, and preventing declaration order
65221
65213
  // from deciding which type "wins" in union subtype reduction.
65222
65214
  // They're still assignable to one another, since `readonly` doesn't affect assignability.
65223
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65224
- !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65215
+ // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
65216
+ if (relation === strictSubtypeRelation &&
65217
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
65225
65218
  return 0 /* False */;
65226
65219
  }
65227
65220
  // If the target comes from a partial union prop, allow `undefined` in the target type
@@ -71781,6 +71774,8 @@ var ts;
71781
71774
  }
71782
71775
  case 229 /* NonNullExpression */:
71783
71776
  return getContextualType(parent, contextFlags);
71777
+ case 270 /* ExportAssignment */:
71778
+ return tryGetTypeFromEffectiveTypeNode(parent);
71784
71779
  case 287 /* JsxExpression */:
71785
71780
  return getContextualTypeForJsxExpression(parent);
71786
71781
  case 284 /* JsxAttribute */:
@@ -130729,7 +130724,7 @@ var ts;
130729
130724
  completionKind === 3 /* MemberLike */ &&
130730
130725
  isClassLikeMemberCompletion(symbol, location)) {
130731
130726
  var importAdder = void 0;
130732
- (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
130727
+ (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
130733
130728
  if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
130734
130729
  hasAction = true;
130735
130730
  source = CompletionSource.ClassMemberSnippet;
@@ -130833,6 +130828,7 @@ var ts;
130833
130828
  return { insertText: name };
130834
130829
  }
130835
130830
  var isSnippet;
130831
+ var replacementSpan;
130836
130832
  var insertText = name;
130837
130833
  var checker = program.getTypeChecker();
130838
130834
  var sourceFile = location.getSourceFile();
@@ -130861,10 +130857,8 @@ var ts;
130861
130857
  var modifiers = 0 /* None */;
130862
130858
  // Whether the suggested member should be abstract.
130863
130859
  // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
130864
- // Note: We are relying on checking if the context token is `abstract`,
130865
- // since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
130866
- // However, that is not true for the e.g. `override` modifier, so this check has its limitations.
130867
- var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
130860
+ var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span;
130861
+ var isAbstract = !!(presentModifiers & 128 /* Abstract */);
130868
130862
  var completionNodes = [];
130869
130863
  ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
130870
130864
  // `addNewNodeForMemberSymbol` calls this callback function for each new member node
@@ -130883,22 +130877,18 @@ var ts;
130883
130877
  && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
130884
130878
  requiredModifiers |= 16384 /* Override */;
130885
130879
  }
130886
- var presentModifiers = 0 /* None */;
130887
130880
  if (!completionNodes.length) {
130888
- // Omit already present modifiers from the first completion node/signature.
130889
- if (contextToken) {
130890
- presentModifiers = getPresentModifiers(contextToken);
130891
- }
130892
130881
  // Keep track of added missing required modifiers and modifiers already present.
130893
130882
  // This is needed when we have overloaded signatures,
130894
130883
  // so this callback will be called for multiple nodes/signatures,
130895
130884
  // and we need to make sure the modifiers are uniform for all nodes/signatures.
130896
130885
  modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
130897
130886
  }
130898
- node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
130887
+ node = ts.factory.updateModifiers(node, modifiers);
130899
130888
  completionNodes.push(node);
130900
130889
  }, body, 2 /* Property */, isAbstract);
130901
130890
  if (completionNodes.length) {
130891
+ replacementSpan = modifiersSpan;
130902
130892
  // If we have access to formatting settings, we print the nodes using the emitter,
130903
130893
  // and then format the printed text.
130904
130894
  if (formatContext) {
@@ -130921,10 +130911,14 @@ var ts;
130921
130911
  insertText = printer.printSnippetList(1 /* MultiLine */ | 131072 /* NoTrailingNewLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
130922
130912
  }
130923
130913
  }
130924
- return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
130914
+ return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder, replacementSpan: replacementSpan };
130925
130915
  }
130926
130916
  function getPresentModifiers(contextToken) {
130917
+ if (!contextToken) {
130918
+ return { modifiers: 0 /* None */ };
130919
+ }
130927
130920
  var modifiers = 0 /* None */;
130921
+ var span;
130928
130922
  var contextMod;
130929
130923
  /*
130930
130924
  Cases supported:
@@ -130947,11 +130941,13 @@ var ts;
130947
130941
  */
130948
130942
  if (contextMod = isModifierLike(contextToken)) {
130949
130943
  modifiers |= ts.modifierToFlag(contextMod);
130944
+ span = ts.createTextSpanFromNode(contextToken);
130950
130945
  }
130951
130946
  if (ts.isPropertyDeclaration(contextToken.parent)) {
130952
130947
  modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
130948
+ span = ts.createTextSpanFromNode(contextToken.parent);
130953
130949
  }
130954
- return modifiers;
130950
+ return { modifiers: modifiers, span: span };
130955
130951
  }
130956
130952
  function isModifierLike(node) {
130957
130953
  if (ts.isModifier(node)) {
@@ -161102,7 +161098,7 @@ var ts;
161102
161098
  var isLastSpan = index === currentNode.templateSpans.length - 1;
161103
161099
  var text = span.literal.text + (isLastSpan ? subsequentText : "");
161104
161100
  var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : "");
161105
- return ts.factory.createTemplateSpan(span.expression, isLast
161101
+ return ts.factory.createTemplateSpan(span.expression, isLast && isLastSpan
161106
161102
  ? ts.factory.createTemplateTail(text, rawText)
161107
161103
  : ts.factory.createTemplateMiddle(text, rawText));
161108
161104
  });
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.20220227";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -31571,18 +31571,8 @@ var ts;
31571
31571
  if (tryParseSemicolon()) {
31572
31572
  return;
31573
31573
  }
31574
- // If an initializer was parsed but there is still an error in finding the next semicolon,
31575
- // we generally know there was an error already reported in the initializer...
31576
- // class Example { a = new Map([), ) }
31577
- // ~
31578
31574
  if (initializer) {
31579
- // ...unless we've found the start of a block after a property declaration, in which
31580
- // case we can know that regardless of the initializer we should complain on the block.
31581
- // class Example { a = 0 {} }
31582
- // ~
31583
- if (token() === 18 /* OpenBraceToken */) {
31584
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31585
- }
31575
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31586
31576
  return;
31587
31577
  }
31588
31578
  parseErrorForMissingSemicolonAfter(name);
@@ -38519,11 +38509,13 @@ var ts;
38519
38509
  ["es2019.string", "lib.es2019.string.d.ts"],
38520
38510
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
38521
38511
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
38512
+ ["es2020.date", "lib.es2020.date.d.ts"],
38522
38513
  ["es2020.promise", "lib.es2020.promise.d.ts"],
38523
38514
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
38524
38515
  ["es2020.string", "lib.es2020.string.d.ts"],
38525
38516
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
38526
38517
  ["es2020.intl", "lib.es2020.intl.d.ts"],
38518
+ ["es2020.number", "lib.es2020.number.d.ts"],
38527
38519
  ["es2021.promise", "lib.es2021.promise.d.ts"],
38528
38520
  ["es2021.string", "lib.es2021.string.d.ts"],
38529
38521
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -55457,8 +55449,8 @@ var ts;
55457
55449
  var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
55458
55450
  return isPrivateWithinAmbient(memberDeclaration);
55459
55451
  }
55460
- function tryGetTypeFromEffectiveTypeNode(declaration) {
55461
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
55452
+ function tryGetTypeFromEffectiveTypeNode(node) {
55453
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
55462
55454
  if (typeNode) {
55463
55455
  return getTypeFromTypeNode(typeNode);
55464
55456
  }
@@ -62477,7 +62469,7 @@ var ts;
62477
62469
  // distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
62478
62470
  // result is (A extends U ? X : Y) | (B extends U ? X : Y).
62479
62471
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
62480
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62472
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62481
62473
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
62482
62474
  root.instantiations.set(id, result);
62483
62475
  }
@@ -65220,8 +65212,9 @@ var ts;
65220
65212
  // This ensures the subtype relationship is ordered, and preventing declaration order
65221
65213
  // from deciding which type "wins" in union subtype reduction.
65222
65214
  // They're still assignable to one another, since `readonly` doesn't affect assignability.
65223
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65224
- !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65215
+ // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
65216
+ if (relation === strictSubtypeRelation &&
65217
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
65225
65218
  return 0 /* False */;
65226
65219
  }
65227
65220
  // If the target comes from a partial union prop, allow `undefined` in the target type
@@ -71781,6 +71774,8 @@ var ts;
71781
71774
  }
71782
71775
  case 229 /* NonNullExpression */:
71783
71776
  return getContextualType(parent, contextFlags);
71777
+ case 270 /* ExportAssignment */:
71778
+ return tryGetTypeFromEffectiveTypeNode(parent);
71784
71779
  case 287 /* JsxExpression */:
71785
71780
  return getContextualTypeForJsxExpression(parent);
71786
71781
  case 284 /* JsxAttribute */:
@@ -130729,7 +130724,7 @@ var ts;
130729
130724
  completionKind === 3 /* MemberLike */ &&
130730
130725
  isClassLikeMemberCompletion(symbol, location)) {
130731
130726
  var importAdder = void 0;
130732
- (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
130727
+ (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
130733
130728
  if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
130734
130729
  hasAction = true;
130735
130730
  source = CompletionSource.ClassMemberSnippet;
@@ -130833,6 +130828,7 @@ var ts;
130833
130828
  return { insertText: name };
130834
130829
  }
130835
130830
  var isSnippet;
130831
+ var replacementSpan;
130836
130832
  var insertText = name;
130837
130833
  var checker = program.getTypeChecker();
130838
130834
  var sourceFile = location.getSourceFile();
@@ -130861,10 +130857,8 @@ var ts;
130861
130857
  var modifiers = 0 /* None */;
130862
130858
  // Whether the suggested member should be abstract.
130863
130859
  // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
130864
- // Note: We are relying on checking if the context token is `abstract`,
130865
- // since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
130866
- // However, that is not true for the e.g. `override` modifier, so this check has its limitations.
130867
- var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
130860
+ var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span;
130861
+ var isAbstract = !!(presentModifiers & 128 /* Abstract */);
130868
130862
  var completionNodes = [];
130869
130863
  ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
130870
130864
  // `addNewNodeForMemberSymbol` calls this callback function for each new member node
@@ -130883,22 +130877,18 @@ var ts;
130883
130877
  && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
130884
130878
  requiredModifiers |= 16384 /* Override */;
130885
130879
  }
130886
- var presentModifiers = 0 /* None */;
130887
130880
  if (!completionNodes.length) {
130888
- // Omit already present modifiers from the first completion node/signature.
130889
- if (contextToken) {
130890
- presentModifiers = getPresentModifiers(contextToken);
130891
- }
130892
130881
  // Keep track of added missing required modifiers and modifiers already present.
130893
130882
  // This is needed when we have overloaded signatures,
130894
130883
  // so this callback will be called for multiple nodes/signatures,
130895
130884
  // and we need to make sure the modifiers are uniform for all nodes/signatures.
130896
130885
  modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
130897
130886
  }
130898
- node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
130887
+ node = ts.factory.updateModifiers(node, modifiers);
130899
130888
  completionNodes.push(node);
130900
130889
  }, body, 2 /* Property */, isAbstract);
130901
130890
  if (completionNodes.length) {
130891
+ replacementSpan = modifiersSpan;
130902
130892
  // If we have access to formatting settings, we print the nodes using the emitter,
130903
130893
  // and then format the printed text.
130904
130894
  if (formatContext) {
@@ -130921,10 +130911,14 @@ var ts;
130921
130911
  insertText = printer.printSnippetList(1 /* MultiLine */ | 131072 /* NoTrailingNewLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
130922
130912
  }
130923
130913
  }
130924
- return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
130914
+ return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder, replacementSpan: replacementSpan };
130925
130915
  }
130926
130916
  function getPresentModifiers(contextToken) {
130917
+ if (!contextToken) {
130918
+ return { modifiers: 0 /* None */ };
130919
+ }
130927
130920
  var modifiers = 0 /* None */;
130921
+ var span;
130928
130922
  var contextMod;
130929
130923
  /*
130930
130924
  Cases supported:
@@ -130947,11 +130941,13 @@ var ts;
130947
130941
  */
130948
130942
  if (contextMod = isModifierLike(contextToken)) {
130949
130943
  modifiers |= ts.modifierToFlag(contextMod);
130944
+ span = ts.createTextSpanFromNode(contextToken);
130950
130945
  }
130951
130946
  if (ts.isPropertyDeclaration(contextToken.parent)) {
130952
130947
  modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
130948
+ span = ts.createTextSpanFromNode(contextToken.parent);
130953
130949
  }
130954
- return modifiers;
130950
+ return { modifiers: modifiers, span: span };
130955
130951
  }
130956
130952
  function isModifierLike(node) {
130957
130953
  if (ts.isModifier(node)) {
@@ -161102,7 +161098,7 @@ var ts;
161102
161098
  var isLastSpan = index === currentNode.templateSpans.length - 1;
161103
161099
  var text = span.literal.text + (isLastSpan ? subsequentText : "");
161104
161100
  var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : "");
161105
- return ts.factory.createTemplateSpan(span.expression, isLast
161101
+ return ts.factory.createTemplateSpan(span.expression, isLast && isLastSpan
161106
161102
  ? ts.factory.createTemplateTail(text, rawText)
161107
161103
  : ts.factory.createTemplateMiddle(text, rawText));
161108
161104
  });
@@ -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.20220227";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -31571,18 +31571,8 @@ var ts;
31571
31571
  if (tryParseSemicolon()) {
31572
31572
  return;
31573
31573
  }
31574
- // If an initializer was parsed but there is still an error in finding the next semicolon,
31575
- // we generally know there was an error already reported in the initializer...
31576
- // class Example { a = new Map([), ) }
31577
- // ~
31578
31574
  if (initializer) {
31579
- // ...unless we've found the start of a block after a property declaration, in which
31580
- // case we can know that regardless of the initializer we should complain on the block.
31581
- // class Example { a = 0 {} }
31582
- // ~
31583
- if (token() === 18 /* OpenBraceToken */) {
31584
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31585
- }
31575
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31586
31576
  return;
31587
31577
  }
31588
31578
  parseErrorForMissingSemicolonAfter(name);
@@ -38519,11 +38509,13 @@ var ts;
38519
38509
  ["es2019.string", "lib.es2019.string.d.ts"],
38520
38510
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
38521
38511
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
38512
+ ["es2020.date", "lib.es2020.date.d.ts"],
38522
38513
  ["es2020.promise", "lib.es2020.promise.d.ts"],
38523
38514
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
38524
38515
  ["es2020.string", "lib.es2020.string.d.ts"],
38525
38516
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
38526
38517
  ["es2020.intl", "lib.es2020.intl.d.ts"],
38518
+ ["es2020.number", "lib.es2020.number.d.ts"],
38527
38519
  ["es2021.promise", "lib.es2021.promise.d.ts"],
38528
38520
  ["es2021.string", "lib.es2021.string.d.ts"],
38529
38521
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -55457,8 +55449,8 @@ var ts;
55457
55449
  var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
55458
55450
  return isPrivateWithinAmbient(memberDeclaration);
55459
55451
  }
55460
- function tryGetTypeFromEffectiveTypeNode(declaration) {
55461
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
55452
+ function tryGetTypeFromEffectiveTypeNode(node) {
55453
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
55462
55454
  if (typeNode) {
55463
55455
  return getTypeFromTypeNode(typeNode);
55464
55456
  }
@@ -62477,7 +62469,7 @@ var ts;
62477
62469
  // distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
62478
62470
  // result is (A extends U ? X : Y) | (B extends U ? X : Y).
62479
62471
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
62480
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62472
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62481
62473
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
62482
62474
  root.instantiations.set(id, result);
62483
62475
  }
@@ -65220,8 +65212,9 @@ var ts;
65220
65212
  // This ensures the subtype relationship is ordered, and preventing declaration order
65221
65213
  // from deciding which type "wins" in union subtype reduction.
65222
65214
  // They're still assignable to one another, since `readonly` doesn't affect assignability.
65223
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65224
- !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65215
+ // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
65216
+ if (relation === strictSubtypeRelation &&
65217
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
65225
65218
  return 0 /* False */;
65226
65219
  }
65227
65220
  // If the target comes from a partial union prop, allow `undefined` in the target type
@@ -71781,6 +71774,8 @@ var ts;
71781
71774
  }
71782
71775
  case 229 /* NonNullExpression */:
71783
71776
  return getContextualType(parent, contextFlags);
71777
+ case 270 /* ExportAssignment */:
71778
+ return tryGetTypeFromEffectiveTypeNode(parent);
71784
71779
  case 287 /* JsxExpression */:
71785
71780
  return getContextualTypeForJsxExpression(parent);
71786
71781
  case 284 /* JsxAttribute */:
@@ -130729,7 +130724,7 @@ var ts;
130729
130724
  completionKind === 3 /* MemberLike */ &&
130730
130725
  isClassLikeMemberCompletion(symbol, location)) {
130731
130726
  var importAdder = void 0;
130732
- (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
130727
+ (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
130733
130728
  if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
130734
130729
  hasAction = true;
130735
130730
  source = CompletionSource.ClassMemberSnippet;
@@ -130833,6 +130828,7 @@ var ts;
130833
130828
  return { insertText: name };
130834
130829
  }
130835
130830
  var isSnippet;
130831
+ var replacementSpan;
130836
130832
  var insertText = name;
130837
130833
  var checker = program.getTypeChecker();
130838
130834
  var sourceFile = location.getSourceFile();
@@ -130861,10 +130857,8 @@ var ts;
130861
130857
  var modifiers = 0 /* None */;
130862
130858
  // Whether the suggested member should be abstract.
130863
130859
  // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
130864
- // Note: We are relying on checking if the context token is `abstract`,
130865
- // since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
130866
- // However, that is not true for the e.g. `override` modifier, so this check has its limitations.
130867
- var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
130860
+ var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span;
130861
+ var isAbstract = !!(presentModifiers & 128 /* Abstract */);
130868
130862
  var completionNodes = [];
130869
130863
  ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
130870
130864
  // `addNewNodeForMemberSymbol` calls this callback function for each new member node
@@ -130883,22 +130877,18 @@ var ts;
130883
130877
  && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
130884
130878
  requiredModifiers |= 16384 /* Override */;
130885
130879
  }
130886
- var presentModifiers = 0 /* None */;
130887
130880
  if (!completionNodes.length) {
130888
- // Omit already present modifiers from the first completion node/signature.
130889
- if (contextToken) {
130890
- presentModifiers = getPresentModifiers(contextToken);
130891
- }
130892
130881
  // Keep track of added missing required modifiers and modifiers already present.
130893
130882
  // This is needed when we have overloaded signatures,
130894
130883
  // so this callback will be called for multiple nodes/signatures,
130895
130884
  // and we need to make sure the modifiers are uniform for all nodes/signatures.
130896
130885
  modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
130897
130886
  }
130898
- node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
130887
+ node = ts.factory.updateModifiers(node, modifiers);
130899
130888
  completionNodes.push(node);
130900
130889
  }, body, 2 /* Property */, isAbstract);
130901
130890
  if (completionNodes.length) {
130891
+ replacementSpan = modifiersSpan;
130902
130892
  // If we have access to formatting settings, we print the nodes using the emitter,
130903
130893
  // and then format the printed text.
130904
130894
  if (formatContext) {
@@ -130921,10 +130911,14 @@ var ts;
130921
130911
  insertText = printer.printSnippetList(1 /* MultiLine */ | 131072 /* NoTrailingNewLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
130922
130912
  }
130923
130913
  }
130924
- return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
130914
+ return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder, replacementSpan: replacementSpan };
130925
130915
  }
130926
130916
  function getPresentModifiers(contextToken) {
130917
+ if (!contextToken) {
130918
+ return { modifiers: 0 /* None */ };
130919
+ }
130927
130920
  var modifiers = 0 /* None */;
130921
+ var span;
130928
130922
  var contextMod;
130929
130923
  /*
130930
130924
  Cases supported:
@@ -130947,11 +130941,13 @@ var ts;
130947
130941
  */
130948
130942
  if (contextMod = isModifierLike(contextToken)) {
130949
130943
  modifiers |= ts.modifierToFlag(contextMod);
130944
+ span = ts.createTextSpanFromNode(contextToken);
130950
130945
  }
130951
130946
  if (ts.isPropertyDeclaration(contextToken.parent)) {
130952
130947
  modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
130948
+ span = ts.createTextSpanFromNode(contextToken.parent);
130953
130949
  }
130954
- return modifiers;
130950
+ return { modifiers: modifiers, span: span };
130955
130951
  }
130956
130952
  function isModifierLike(node) {
130957
130953
  if (ts.isModifier(node)) {
@@ -161102,7 +161098,7 @@ var ts;
161102
161098
  var isLastSpan = index === currentNode.templateSpans.length - 1;
161103
161099
  var text = span.literal.text + (isLastSpan ? subsequentText : "");
161104
161100
  var rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : "");
161105
- return ts.factory.createTemplateSpan(span.expression, isLast
161101
+ return ts.factory.createTemplateSpan(span.expression, isLast && isLastSpan
161106
161102
  ? ts.factory.createTemplateTail(text, rawText)
161107
161103
  : ts.factory.createTemplateMiddle(text, rawText));
161108
161104
  });
@@ -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.20220227";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220302";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -31366,18 +31366,8 @@ var ts;
31366
31366
  if (tryParseSemicolon()) {
31367
31367
  return;
31368
31368
  }
31369
- // If an initializer was parsed but there is still an error in finding the next semicolon,
31370
- // we generally know there was an error already reported in the initializer...
31371
- // class Example { a = new Map([), ) }
31372
- // ~
31373
31369
  if (initializer) {
31374
- // ...unless we've found the start of a block after a property declaration, in which
31375
- // case we can know that regardless of the initializer we should complain on the block.
31376
- // class Example { a = 0 {} }
31377
- // ~
31378
- if (token() === 18 /* OpenBraceToken */) {
31379
- parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31380
- }
31370
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(26 /* SemicolonToken */));
31381
31371
  return;
31382
31372
  }
31383
31373
  parseErrorForMissingSemicolonAfter(name);
@@ -38314,11 +38304,13 @@ var ts;
38314
38304
  ["es2019.string", "lib.es2019.string.d.ts"],
38315
38305
  ["es2019.symbol", "lib.es2019.symbol.d.ts"],
38316
38306
  ["es2020.bigint", "lib.es2020.bigint.d.ts"],
38307
+ ["es2020.date", "lib.es2020.date.d.ts"],
38317
38308
  ["es2020.promise", "lib.es2020.promise.d.ts"],
38318
38309
  ["es2020.sharedmemory", "lib.es2020.sharedmemory.d.ts"],
38319
38310
  ["es2020.string", "lib.es2020.string.d.ts"],
38320
38311
  ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
38321
38312
  ["es2020.intl", "lib.es2020.intl.d.ts"],
38313
+ ["es2020.number", "lib.es2020.number.d.ts"],
38322
38314
  ["es2021.promise", "lib.es2021.promise.d.ts"],
38323
38315
  ["es2021.string", "lib.es2021.string.d.ts"],
38324
38316
  ["es2021.weakref", "lib.es2021.weakref.d.ts"],
@@ -55252,8 +55244,8 @@ var ts;
55252
55244
  var memberDeclaration = root.kind === 163 /* Parameter */ ? root.parent : root;
55253
55245
  return isPrivateWithinAmbient(memberDeclaration);
55254
55246
  }
55255
- function tryGetTypeFromEffectiveTypeNode(declaration) {
55256
- var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
55247
+ function tryGetTypeFromEffectiveTypeNode(node) {
55248
+ var typeNode = ts.getEffectiveTypeAnnotationNode(node);
55257
55249
  if (typeNode) {
55258
55250
  return getTypeFromTypeNode(typeNode);
55259
55251
  }
@@ -62272,7 +62264,7 @@ var ts;
62272
62264
  // distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
62273
62265
  // result is (A extends U ? X : Y) | (B extends U ? X : Y).
62274
62266
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
62275
- mapTypeWithAlias(distributionType, function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62267
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
62276
62268
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
62277
62269
  root.instantiations.set(id, result);
62278
62270
  }
@@ -65015,8 +65007,9 @@ var ts;
65015
65007
  // This ensures the subtype relationship is ordered, and preventing declaration order
65016
65008
  // from deciding which type "wins" in union subtype reduction.
65017
65009
  // They're still assignable to one another, since `readonly` doesn't affect assignability.
65018
- if ((relation === subtypeRelation || relation === strictSubtypeRelation) &&
65019
- !!(sourcePropFlags & 64 /* Readonly */) && !(targetPropFlags & 64 /* Readonly */)) {
65010
+ // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction
65011
+ if (relation === strictSubtypeRelation &&
65012
+ isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
65020
65013
  return 0 /* False */;
65021
65014
  }
65022
65015
  // If the target comes from a partial union prop, allow `undefined` in the target type
@@ -71576,6 +71569,8 @@ var ts;
71576
71569
  }
71577
71570
  case 229 /* NonNullExpression */:
71578
71571
  return getContextualType(parent, contextFlags);
71572
+ case 270 /* ExportAssignment */:
71573
+ return tryGetTypeFromEffectiveTypeNode(parent);
71579
71574
  case 287 /* JsxExpression */:
71580
71575
  return getContextualTypeForJsxExpression(parent);
71581
71576
  case 284 /* JsxAttribute */:
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.20220227",
5
+ "version": "4.7.0-dev.20220302",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [