typescript 5.6.0-dev.20240818 → 5.6.1-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.6";
21
- var version = `${versionMajorMinor}.0-dev.20240818`;
21
+ var version = "5.6.1-rc";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6121,6 +6121,27 @@ declare namespace ts {
6121
6121
  getBaseTypes(type: InterfaceType): BaseType[];
6122
6122
  getBaseTypeOfLiteralType(type: Type): Type;
6123
6123
  getWidenedType(type: Type): Type;
6124
+ /**
6125
+ * Gets the "awaited type" of a type.
6126
+ *
6127
+ * If an expression has a Promise-like type, the "awaited type" of the expression is
6128
+ * derived from the type of the first argument of the fulfillment callback for that
6129
+ * Promise's `then` method. If the "awaited type" is itself a Promise-like, it is
6130
+ * recursively unwrapped in the same manner until a non-promise type is found.
6131
+ *
6132
+ * If an expression does not have a Promise-like type, its "awaited type" is the type
6133
+ * of the expression.
6134
+ *
6135
+ * If the resulting "awaited type" is a generic object type, then it is wrapped in
6136
+ * an `Awaited<T>`.
6137
+ *
6138
+ * In the event the "awaited type" circularly references itself, or is a non-Promise
6139
+ * object-type with a callable `then()` method, an "awaited type" cannot be determined
6140
+ * and the value `undefined` will be returned.
6141
+ *
6142
+ * This is used to reflect the runtime behavior of the `await` keyword.
6143
+ */
6144
+ getAwaitedType(type: Type): Type | undefined;
6124
6145
  getReturnTypeOfSignature(signature: Signature): Type;
6125
6146
  getNullableType(type: Type, flags: TypeFlags): Type;
6126
6147
  getNonNullableType(type: Type): Type;
package/lib/typescript.js CHANGED
@@ -2263,7 +2263,7 @@ module.exports = __toCommonJS(typescript_exports);
2263
2263
 
2264
2264
  // src/compiler/corePublic.ts
2265
2265
  var versionMajorMinor = "5.6";
2266
- var version = `${versionMajorMinor}.0-dev.20240818`;
2266
+ var version = "5.6.1-rc";
2267
2267
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2268
2268
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2269
2269
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -179399,13 +179399,13 @@ function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom,
179399
179399
  function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
179400
179400
  let actualPastedText;
179401
179401
  if (pastedText.length !== pasteLocations.length) {
179402
- actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
179402
+ actualPastedText = pastedText.length === 1 ? pastedText[0] : pastedText.join(getNewLineOrDefaultFromHost(formatContext.host, formatContext.options));
179403
179403
  }
179404
179404
  const statements = [];
179405
179405
  let newText = targetFile.text;
179406
179406
  for (let i = pasteLocations.length - 1; i >= 0; i--) {
179407
179407
  const { pos, end } = pasteLocations[i];
179408
- newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
179408
+ newText = actualPastedText ? newText.slice(0, pos) + actualPastedText + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
179409
179409
  }
179410
179410
  let importAdder;
179411
179411
  Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
@@ -179436,22 +179436,37 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
179436
179436
  preferences,
179437
179437
  formatContext
179438
179438
  };
179439
- forEachChild(updatedFile, function cb(node) {
179440
- if (isIdentifier(node) && !(originalProgram == null ? void 0 : originalProgram.getTypeChecker().resolveName(
179441
- node.text,
179442
- node,
179443
- -1 /* All */,
179444
- /*excludeGlobals*/
179445
- false
179446
- ))) {
179447
- importAdder.addImportForUnresolvedIdentifier(
179448
- context,
179439
+ let offset = 0;
179440
+ pasteLocations.forEach((location, i) => {
179441
+ const oldTextLength = location.end - location.pos;
179442
+ const textToBePasted = actualPastedText ?? pastedText[i];
179443
+ const startPos = location.pos + offset;
179444
+ const endPos = startPos + textToBePasted.length;
179445
+ const range = { pos: startPos, end: endPos };
179446
+ offset += textToBePasted.length - oldTextLength;
179447
+ const enclosingNode = findAncestor(
179448
+ getTokenAtPosition(context.sourceFile, range.pos),
179449
+ (ancestorNode) => rangeContainsRange(ancestorNode, range)
179450
+ );
179451
+ if (!enclosingNode) return;
179452
+ forEachChild(enclosingNode, function importUnresolvedIdentifiers(node) {
179453
+ const isImportCandidate = isIdentifier(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName(
179454
+ node.text,
179449
179455
  node,
179450
- /*useAutoImportProvider*/
179451
- true
179452
- );
179453
- }
179454
- node.forEachChild(cb);
179456
+ -1 /* All */,
179457
+ /*excludeGlobals*/
179458
+ false
179459
+ ));
179460
+ if (isImportCandidate) {
179461
+ return importAdder.addImportForUnresolvedIdentifier(
179462
+ context,
179463
+ node,
179464
+ /*useAutoImportProvider*/
179465
+ true
179466
+ );
179467
+ }
179468
+ node.forEachChild(importUnresolvedIdentifiers);
179469
+ });
179455
179470
  });
179456
179471
  }
179457
179472
  importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
@@ -179463,7 +179478,7 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
179463
179478
  changes.replaceRangeWithText(
179464
179479
  targetFile,
179465
179480
  { pos: paste.pos, end: paste.end },
179466
- actualPastedText ? actualPastedText[0] : pastedText[i]
179481
+ actualPastedText ?? pastedText[i]
179467
179482
  );
179468
179483
  });
179469
179484
  }
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": "5.6.0-dev.20240818",
5
+ "version": "5.6.1-rc",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -117,5 +117,5 @@
117
117
  "node": "20.1.0",
118
118
  "npm": "8.19.4"
119
119
  },
120
- "gitHead": "2a8865e6ba95c9bdcdb9e2c9c08f10c5f5c75391"
120
+ "gitHead": "6212132b835145b1a8fd49982680ac668caf3ddc"
121
121
  }