typescript 5.4.0-dev.20240101 → 5.4.0-dev.20240103

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.
@@ -0,0 +1,28 @@
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
+ /// <reference no-default-lib="true"/>
18
+
19
+ /////////////////////////////
20
+ /// Window Async Iterable APIs
21
+ /////////////////////////////
22
+
23
+ interface FileSystemDirectoryHandle {
24
+ [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
25
+ entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
26
+ keys(): AsyncIterableIterator<string>;
27
+ values(): AsyncIterableIterator<FileSystemHandle>;
28
+ }
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -21,3 +21,4 @@ and limitations under the License.
21
21
  /// <reference lib="webworker.importscripts" />
22
22
  /// <reference lib="scripthost" />
23
23
  /// <reference lib="dom.iterable" />
24
+ /// <reference lib="dom.asynciterable" />
@@ -0,0 +1,28 @@
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
+ /// <reference no-default-lib="true"/>
18
+
19
+ /////////////////////////////
20
+ /// Worker Async Iterable APIs
21
+ /////////////////////////////
22
+
23
+ interface FileSystemDirectoryHandle {
24
+ [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
25
+ entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
26
+ keys(): AsyncIterableIterator<string>;
27
+ values(): AsyncIterableIterator<FileSystemHandle>;
28
+ }
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.4";
21
- var version = `${versionMajorMinor}.0-dev.20240101`;
21
+ var version = `${versionMajorMinor}.0-dev.20240103`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -34003,9 +34003,11 @@ var libEntries = [
34003
34003
  // Host only
34004
34004
  ["dom", "lib.dom.d.ts"],
34005
34005
  ["dom.iterable", "lib.dom.iterable.d.ts"],
34006
+ ["dom.asynciterable", "lib.dom.asynciterable.d.ts"],
34006
34007
  ["webworker", "lib.webworker.d.ts"],
34007
34008
  ["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
34008
34009
  ["webworker.iterable", "lib.webworker.iterable.d.ts"],
34010
+ ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
34009
34011
  ["scripthost", "lib.scripthost.d.ts"],
34010
34012
  // ES2015 Or ESNext By-feature options
34011
34013
  ["es2015.core", "lib.es2015.core.d.ts"],
@@ -59053,6 +59055,12 @@ function createTypeChecker(host) {
59053
59055
  return type;
59054
59056
  }
59055
59057
  function getESSymbolLikeTypeForNode(node) {
59058
+ if (isInJSFile(node) && isJSDocTypeExpression(node)) {
59059
+ const host2 = getJSDocHost(node);
59060
+ if (host2) {
59061
+ node = getSingleVariableOfVariableStatement(host2) || host2;
59062
+ }
59063
+ }
59056
59064
  if (isValidESSymbolDeclaration(node)) {
59057
59065
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
59058
59066
  if (symbol) {
@@ -61997,7 +62005,7 @@ function createTypeChecker(host) {
61997
62005
  }
61998
62006
  if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
61999
62007
  let constraint = getConstraintOfTypeParameter(source2);
62000
- if (constraint && hasNonCircularBaseConstraint(source2)) {
62008
+ if (constraint) {
62001
62009
  while (constraint && someType(constraint, (c) => !!(c.flags & 262144 /* TypeParameter */))) {
62002
62010
  if (result2 = isRelatedTo(
62003
62011
  constraint,
@@ -64626,6 +64634,9 @@ function createTypeChecker(host) {
64626
64634
  inferToTemplateLiteralType(source, target);
64627
64635
  } else {
64628
64636
  source = getReducedType(source);
64637
+ if (isGenericMappedType(source) && isGenericMappedType(target)) {
64638
+ invokeOnce(source, target, inferFromGenericMappedTypes);
64639
+ }
64629
64640
  if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
64630
64641
  const apparentSource = getApparentType(source);
64631
64642
  if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
@@ -64889,6 +64900,14 @@ function createTypeChecker(host) {
64889
64900
  }
64890
64901
  }
64891
64902
  }
64903
+ function inferFromGenericMappedTypes(source, target) {
64904
+ inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
64905
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
64906
+ const sourceNameType = getNameTypeFromMappedType(source);
64907
+ const targetNameType = getNameTypeFromMappedType(target);
64908
+ if (sourceNameType && targetNameType)
64909
+ inferFromTypes(sourceNameType, targetNameType);
64910
+ }
64892
64911
  function inferFromObjectTypes(source, target) {
64893
64912
  var _a, _b;
64894
64913
  if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
@@ -64896,12 +64915,7 @@ function createTypeChecker(host) {
64896
64915
  return;
64897
64916
  }
64898
64917
  if (isGenericMappedType(source) && isGenericMappedType(target)) {
64899
- inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
64900
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
64901
- const sourceNameType = getNameTypeFromMappedType(source);
64902
- const targetNameType = getNameTypeFromMappedType(target);
64903
- if (sourceNameType && targetNameType)
64904
- inferFromTypes(sourceNameType, targetNameType);
64918
+ inferFromGenericMappedTypes(source, target);
64905
64919
  }
64906
64920
  if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
64907
64921
  const constraintType = getConstraintTypeFromMappedType(target);
package/lib/tsserver.js CHANGED
@@ -2339,7 +2339,7 @@ module.exports = __toCommonJS(server_exports);
2339
2339
 
2340
2340
  // src/compiler/corePublic.ts
2341
2341
  var versionMajorMinor = "5.4";
2342
- var version = `${versionMajorMinor}.0-dev.20240101`;
2342
+ var version = `${versionMajorMinor}.0-dev.20240103`;
2343
2343
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2344
2344
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2345
2345
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -38422,9 +38422,11 @@ var libEntries = [
38422
38422
  // Host only
38423
38423
  ["dom", "lib.dom.d.ts"],
38424
38424
  ["dom.iterable", "lib.dom.iterable.d.ts"],
38425
+ ["dom.asynciterable", "lib.dom.asynciterable.d.ts"],
38425
38426
  ["webworker", "lib.webworker.d.ts"],
38426
38427
  ["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
38427
38428
  ["webworker.iterable", "lib.webworker.iterable.d.ts"],
38429
+ ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
38428
38430
  ["scripthost", "lib.scripthost.d.ts"],
38429
38431
  // ES2015 Or ESNext By-feature options
38430
38432
  ["es2015.core", "lib.es2015.core.d.ts"],
@@ -63772,6 +63774,12 @@ function createTypeChecker(host) {
63772
63774
  return type;
63773
63775
  }
63774
63776
  function getESSymbolLikeTypeForNode(node) {
63777
+ if (isInJSFile(node) && isJSDocTypeExpression(node)) {
63778
+ const host2 = getJSDocHost(node);
63779
+ if (host2) {
63780
+ node = getSingleVariableOfVariableStatement(host2) || host2;
63781
+ }
63782
+ }
63775
63783
  if (isValidESSymbolDeclaration(node)) {
63776
63784
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
63777
63785
  if (symbol) {
@@ -66716,7 +66724,7 @@ function createTypeChecker(host) {
66716
66724
  }
66717
66725
  if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
66718
66726
  let constraint = getConstraintOfTypeParameter(source2);
66719
- if (constraint && hasNonCircularBaseConstraint(source2)) {
66727
+ if (constraint) {
66720
66728
  while (constraint && someType(constraint, (c) => !!(c.flags & 262144 /* TypeParameter */))) {
66721
66729
  if (result2 = isRelatedTo(
66722
66730
  constraint,
@@ -69345,6 +69353,9 @@ function createTypeChecker(host) {
69345
69353
  inferToTemplateLiteralType(source, target);
69346
69354
  } else {
69347
69355
  source = getReducedType(source);
69356
+ if (isGenericMappedType(source) && isGenericMappedType(target)) {
69357
+ invokeOnce(source, target, inferFromGenericMappedTypes);
69358
+ }
69348
69359
  if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
69349
69360
  const apparentSource = getApparentType(source);
69350
69361
  if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
@@ -69608,6 +69619,14 @@ function createTypeChecker(host) {
69608
69619
  }
69609
69620
  }
69610
69621
  }
69622
+ function inferFromGenericMappedTypes(source, target) {
69623
+ inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
69624
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
69625
+ const sourceNameType = getNameTypeFromMappedType(source);
69626
+ const targetNameType = getNameTypeFromMappedType(target);
69627
+ if (sourceNameType && targetNameType)
69628
+ inferFromTypes(sourceNameType, targetNameType);
69629
+ }
69611
69630
  function inferFromObjectTypes(source, target) {
69612
69631
  var _a, _b;
69613
69632
  if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
@@ -69615,12 +69634,7 @@ function createTypeChecker(host) {
69615
69634
  return;
69616
69635
  }
69617
69636
  if (isGenericMappedType(source) && isGenericMappedType(target)) {
69618
- inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
69619
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
69620
- const sourceNameType = getNameTypeFromMappedType(source);
69621
- const targetNameType = getNameTypeFromMappedType(target);
69622
- if (sourceNameType && targetNameType)
69623
- inferFromTypes(sourceNameType, targetNameType);
69637
+ inferFromGenericMappedTypes(source, target);
69624
69638
  }
69625
69639
  if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
69626
69640
  const constraintType = getConstraintTypeFromMappedType(target);
@@ -134218,10 +134232,11 @@ function buildLinkParts(link, checker) {
134218
134232
  }
134219
134233
  } else {
134220
134234
  const symbol = checker == null ? void 0 : checker.getSymbolAtLocation(link.name);
134235
+ const targetSymbol = symbol && checker ? getSymbolTarget(symbol, checker) : void 0;
134221
134236
  const suffix = findLinkNameEnd(link.text);
134222
134237
  const name = getTextOfNode(link.name) + link.text.slice(0, suffix);
134223
134238
  const text = skipSeparatorFromLinkText(link.text.slice(suffix));
134224
- const decl = (symbol == null ? void 0 : symbol.valueDeclaration) || ((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a[0]);
134239
+ const decl = (targetSymbol == null ? void 0 : targetSymbol.valueDeclaration) || ((_a = targetSymbol == null ? void 0 : targetSymbol.declarations) == null ? void 0 : _a[0]);
134225
134240
  if (decl) {
134226
134241
  parts.push(linkNamePart(name, decl));
134227
134242
  if (text)
@@ -147624,21 +147639,24 @@ __export(ts_CallHierarchy_exports, {
147624
147639
  function isNamedExpression(node) {
147625
147640
  return (isFunctionExpression(node) || isClassExpression(node)) && isNamedDeclaration(node);
147626
147641
  }
147627
- function isConstNamedExpression(node) {
147628
- return (isFunctionExpression(node) || isArrowFunction(node) || isClassExpression(node)) && isVariableDeclaration(node.parent) && node === node.parent.initializer && isIdentifier(node.parent.name) && !!(getCombinedNodeFlags(node.parent) & 2 /* Const */);
147642
+ function isVariableLike2(node) {
147643
+ return isPropertyDeclaration(node) || isVariableDeclaration(node);
147644
+ }
147645
+ function isAssignedExpression(node) {
147646
+ return (isFunctionExpression(node) || isArrowFunction(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2 /* Const */) || isPropertyDeclaration(node.parent));
147629
147647
  }
147630
147648
  function isPossibleCallHierarchyDeclaration(node) {
147631
147649
  return isSourceFile(node) || isModuleDeclaration(node) || isFunctionDeclaration(node) || isFunctionExpression(node) || isClassDeclaration(node) || isClassExpression(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node);
147632
147650
  }
147633
147651
  function isValidCallHierarchyDeclaration(node) {
147634
- return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier(node.name) || isFunctionDeclaration(node) || isClassDeclaration(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isConstNamedExpression(node);
147652
+ return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier(node.name) || isFunctionDeclaration(node) || isClassDeclaration(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isAssignedExpression(node);
147635
147653
  }
147636
147654
  function getCallHierarchyDeclarationReferenceNode(node) {
147637
147655
  if (isSourceFile(node))
147638
147656
  return node;
147639
147657
  if (isNamedDeclaration(node))
147640
147658
  return node.name;
147641
- if (isConstNamedExpression(node))
147659
+ if (isAssignedExpression(node))
147642
147660
  return node.parent.name;
147643
147661
  return Debug.checkDefined(node.modifiers && find(node.modifiers, isDefaultModifier3));
147644
147662
  }
@@ -147668,7 +147686,7 @@ function getCallHierarchyItemName(program, node) {
147668
147686
  const prefix = symbol ? `${typeChecker.symbolToString(symbol, node.parent)} ` : "";
147669
147687
  return { text: `${prefix}static {}`, pos, end };
147670
147688
  }
147671
- const declName = isConstNamedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name");
147689
+ const declName = isAssignedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name");
147672
147690
  let text = isIdentifier(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0;
147673
147691
  if (text === void 0) {
147674
147692
  const typeChecker = program.getTypeChecker();
@@ -147684,8 +147702,11 @@ function getCallHierarchyItemName(program, node) {
147684
147702
  return { text, pos: declName.getStart(), end: declName.getEnd() };
147685
147703
  }
147686
147704
  function getCallHierarchItemContainerName(node) {
147687
- var _a, _b;
147688
- if (isConstNamedExpression(node)) {
147705
+ var _a, _b, _c, _d;
147706
+ if (isAssignedExpression(node)) {
147707
+ if (isPropertyDeclaration(node.parent) && isClassLike(node.parent.parent)) {
147708
+ return isClassExpression(node.parent.parent) ? (_a = getAssignedName(node.parent.parent)) == null ? void 0 : _a.getText() : (_b = node.parent.parent.name) == null ? void 0 : _b.getText();
147709
+ }
147689
147710
  if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier(node.parent.parent.parent.parent.parent.name)) {
147690
147711
  return node.parent.parent.parent.parent.parent.name.getText();
147691
147712
  }
@@ -147696,9 +147717,9 @@ function getCallHierarchItemContainerName(node) {
147696
147717
  case 178 /* SetAccessor */:
147697
147718
  case 174 /* MethodDeclaration */:
147698
147719
  if (node.parent.kind === 210 /* ObjectLiteralExpression */) {
147699
- return (_a = getAssignedName(node.parent)) == null ? void 0 : _a.getText();
147720
+ return (_c = getAssignedName(node.parent)) == null ? void 0 : _c.getText();
147700
147721
  }
147701
- return (_b = getNameOfDeclaration(node.parent)) == null ? void 0 : _b.getText();
147722
+ return (_d = getNameOfDeclaration(node.parent)) == null ? void 0 : _d.getText();
147702
147723
  case 262 /* FunctionDeclaration */:
147703
147724
  case 263 /* ClassDeclaration */:
147704
147725
  case 267 /* ModuleDeclaration */:
@@ -147771,7 +147792,7 @@ function resolveCallHierarchyDeclaration(program, location) {
147771
147792
  const ancestor = findAncestor(location.parent, isValidCallHierarchyDeclaration);
147772
147793
  return ancestor && findImplementationOrAllInitialDeclarations(typeChecker, ancestor);
147773
147794
  }
147774
- if (isVariableDeclaration(location.parent) && location.parent.initializer && isConstNamedExpression(location.parent.initializer)) {
147795
+ if (isVariableLike2(location.parent) && location.parent.initializer && isAssignedExpression(location.parent.initializer)) {
147775
147796
  return location.parent.initializer;
147776
147797
  }
147777
147798
  return void 0;
@@ -147786,7 +147807,7 @@ function resolveCallHierarchyDeclaration(program, location) {
147786
147807
  location = location.parent;
147787
147808
  continue;
147788
147809
  }
147789
- if (isVariableDeclaration(location) && location.initializer && isConstNamedExpression(location.initializer)) {
147810
+ if (isVariableDeclaration(location) && location.initializer && isAssignedExpression(location.initializer)) {
147790
147811
  return location.initializer;
147791
147812
  }
147792
147813
  if (!followingSymbol) {
@@ -153742,21 +153763,14 @@ function addEnumMemberDeclaration(changes, checker, { token, parentDeclaration }
153742
153763
  const type = checker.getTypeAtLocation(member);
153743
153764
  return !!(type && type.flags & 402653316 /* StringLike */);
153744
153765
  });
153766
+ const sourceFile = parentDeclaration.getSourceFile();
153745
153767
  const enumMember = factory.createEnumMember(token, hasStringInitializer ? factory.createStringLiteral(token.text) : void 0);
153746
- changes.replaceNode(
153747
- parentDeclaration.getSourceFile(),
153748
- parentDeclaration,
153749
- factory.updateEnumDeclaration(
153750
- parentDeclaration,
153751
- parentDeclaration.modifiers,
153752
- parentDeclaration.name,
153753
- concatenate(parentDeclaration.members, singleElementArray(enumMember))
153754
- ),
153755
- {
153756
- leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll,
153757
- trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Exclude
153758
- }
153759
- );
153768
+ const last2 = lastOrUndefined(parentDeclaration.members);
153769
+ if (last2) {
153770
+ changes.insertNodeInListAfter(sourceFile, last2, enumMember, parentDeclaration.members);
153771
+ } else {
153772
+ changes.insertMemberAtStart(sourceFile, parentDeclaration, enumMember);
153773
+ }
153760
153774
  }
153761
153775
  function addFunctionDeclaration(changes, context, info) {
153762
153776
  const quotePreference = getQuotePreference(context.sourceFile, context.preferences);
@@ -153859,7 +153873,7 @@ function tryGetValueFromType(context, checker, importAdder, quotePreference, typ
153859
153873
  /*enclosingDeclaration*/
153860
153874
  void 0,
153861
153875
  /*flags*/
153862
- void 0
153876
+ 64 /* UseFullyQualifiedType */
153863
153877
  );
153864
153878
  return enumMember === void 0 || name === void 0 ? factory.createNumericLiteral(0) : factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember));
153865
153879
  }
@@ -170284,7 +170298,7 @@ ${options.prefix}` : "\n" : options.prefix
170284
170298
  const afterMinusOneStartLinePosition = getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile);
170285
170299
  multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition;
170286
170300
  }
170287
- if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) {
170301
+ if (hasCommentsBeforeLineBreak(sourceFile.text, after.end) || !positionsAreOnSameLine(containingList.pos, containingList.end, sourceFile)) {
170288
170302
  multilineList = true;
170289
170303
  }
170290
170304
  if (multilineList) {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-dev.20240101`;
38
+ version = `${versionMajorMinor}.0-dev.20240103`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -37918,9 +37918,11 @@ ${lanes.join("\n")}
37918
37918
  // Host only
37919
37919
  ["dom", "lib.dom.d.ts"],
37920
37920
  ["dom.iterable", "lib.dom.iterable.d.ts"],
37921
+ ["dom.asynciterable", "lib.dom.asynciterable.d.ts"],
37921
37922
  ["webworker", "lib.webworker.d.ts"],
37922
37923
  ["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
37923
37924
  ["webworker.iterable", "lib.webworker.iterable.d.ts"],
37925
+ ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
37924
37926
  ["scripthost", "lib.scripthost.d.ts"],
37925
37927
  // ES2015 Or ESNext By-feature options
37926
37928
  ["es2015.core", "lib.es2015.core.d.ts"],
@@ -61528,6 +61530,12 @@ ${lanes.join("\n")}
61528
61530
  return type;
61529
61531
  }
61530
61532
  function getESSymbolLikeTypeForNode(node) {
61533
+ if (isInJSFile(node) && isJSDocTypeExpression(node)) {
61534
+ const host2 = getJSDocHost(node);
61535
+ if (host2) {
61536
+ node = getSingleVariableOfVariableStatement(host2) || host2;
61537
+ }
61538
+ }
61531
61539
  if (isValidESSymbolDeclaration(node)) {
61532
61540
  const symbol = isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
61533
61541
  if (symbol) {
@@ -64472,7 +64480,7 @@ ${lanes.join("\n")}
64472
64480
  }
64473
64481
  if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
64474
64482
  let constraint = getConstraintOfTypeParameter(source2);
64475
- if (constraint && hasNonCircularBaseConstraint(source2)) {
64483
+ if (constraint) {
64476
64484
  while (constraint && someType(constraint, (c) => !!(c.flags & 262144 /* TypeParameter */))) {
64477
64485
  if (result2 = isRelatedTo(
64478
64486
  constraint,
@@ -67101,6 +67109,9 @@ ${lanes.join("\n")}
67101
67109
  inferToTemplateLiteralType(source, target);
67102
67110
  } else {
67103
67111
  source = getReducedType(source);
67112
+ if (isGenericMappedType(source) && isGenericMappedType(target)) {
67113
+ invokeOnce(source, target, inferFromGenericMappedTypes);
67114
+ }
67104
67115
  if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
67105
67116
  const apparentSource = getApparentType(source);
67106
67117
  if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
@@ -67364,6 +67375,14 @@ ${lanes.join("\n")}
67364
67375
  }
67365
67376
  }
67366
67377
  }
67378
+ function inferFromGenericMappedTypes(source, target) {
67379
+ inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
67380
+ inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
67381
+ const sourceNameType = getNameTypeFromMappedType(source);
67382
+ const targetNameType = getNameTypeFromMappedType(target);
67383
+ if (sourceNameType && targetNameType)
67384
+ inferFromTypes(sourceNameType, targetNameType);
67385
+ }
67367
67386
  function inferFromObjectTypes(source, target) {
67368
67387
  var _a, _b;
67369
67388
  if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) {
@@ -67371,12 +67390,7 @@ ${lanes.join("\n")}
67371
67390
  return;
67372
67391
  }
67373
67392
  if (isGenericMappedType(source) && isGenericMappedType(target)) {
67374
- inferFromTypes(getConstraintTypeFromMappedType(source), getConstraintTypeFromMappedType(target));
67375
- inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target));
67376
- const sourceNameType = getNameTypeFromMappedType(source);
67377
- const targetNameType = getNameTypeFromMappedType(target);
67378
- if (sourceNameType && targetNameType)
67379
- inferFromTypes(sourceNameType, targetNameType);
67393
+ inferFromGenericMappedTypes(source, target);
67380
67394
  }
67381
67395
  if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
67382
67396
  const constraintType = getConstraintTypeFromMappedType(target);
@@ -132473,10 +132487,11 @@ ${lanes.join("\n")}
132473
132487
  }
132474
132488
  } else {
132475
132489
  const symbol = checker == null ? void 0 : checker.getSymbolAtLocation(link.name);
132490
+ const targetSymbol = symbol && checker ? getSymbolTarget(symbol, checker) : void 0;
132476
132491
  const suffix = findLinkNameEnd(link.text);
132477
132492
  const name = getTextOfNode(link.name) + link.text.slice(0, suffix);
132478
132493
  const text = skipSeparatorFromLinkText(link.text.slice(suffix));
132479
- const decl = (symbol == null ? void 0 : symbol.valueDeclaration) || ((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a[0]);
132494
+ const decl = (targetSymbol == null ? void 0 : targetSymbol.valueDeclaration) || ((_a = targetSymbol == null ? void 0 : targetSymbol.declarations) == null ? void 0 : _a[0]);
132480
132495
  if (decl) {
132481
132496
  parts.push(linkNamePart(name, decl));
132482
132497
  if (text)
@@ -146245,21 +146260,24 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146245
146260
  function isNamedExpression(node) {
146246
146261
  return (isFunctionExpression(node) || isClassExpression(node)) && isNamedDeclaration(node);
146247
146262
  }
146248
- function isConstNamedExpression(node) {
146249
- return (isFunctionExpression(node) || isArrowFunction(node) || isClassExpression(node)) && isVariableDeclaration(node.parent) && node === node.parent.initializer && isIdentifier(node.parent.name) && !!(getCombinedNodeFlags(node.parent) & 2 /* Const */);
146263
+ function isVariableLike2(node) {
146264
+ return isPropertyDeclaration(node) || isVariableDeclaration(node);
146265
+ }
146266
+ function isAssignedExpression(node) {
146267
+ return (isFunctionExpression(node) || isArrowFunction(node) || isClassExpression(node)) && isVariableLike2(node.parent) && node === node.parent.initializer && isIdentifier(node.parent.name) && (!!(getCombinedNodeFlags(node.parent) & 2 /* Const */) || isPropertyDeclaration(node.parent));
146250
146268
  }
146251
146269
  function isPossibleCallHierarchyDeclaration(node) {
146252
146270
  return isSourceFile(node) || isModuleDeclaration(node) || isFunctionDeclaration(node) || isFunctionExpression(node) || isClassDeclaration(node) || isClassExpression(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node);
146253
146271
  }
146254
146272
  function isValidCallHierarchyDeclaration(node) {
146255
- return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier(node.name) || isFunctionDeclaration(node) || isClassDeclaration(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isConstNamedExpression(node);
146273
+ return isSourceFile(node) || isModuleDeclaration(node) && isIdentifier(node.name) || isFunctionDeclaration(node) || isClassDeclaration(node) || isClassStaticBlockDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node) || isNamedExpression(node) || isAssignedExpression(node);
146256
146274
  }
146257
146275
  function getCallHierarchyDeclarationReferenceNode(node) {
146258
146276
  if (isSourceFile(node))
146259
146277
  return node;
146260
146278
  if (isNamedDeclaration(node))
146261
146279
  return node.name;
146262
- if (isConstNamedExpression(node))
146280
+ if (isAssignedExpression(node))
146263
146281
  return node.parent.name;
146264
146282
  return Debug.checkDefined(node.modifiers && find(node.modifiers, isDefaultModifier3));
146265
146283
  }
@@ -146289,7 +146307,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146289
146307
  const prefix = symbol ? `${typeChecker.symbolToString(symbol, node.parent)} ` : "";
146290
146308
  return { text: `${prefix}static {}`, pos, end };
146291
146309
  }
146292
- const declName = isConstNamedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name");
146310
+ const declName = isAssignedExpression(node) ? node.parent.name : Debug.checkDefined(getNameOfDeclaration(node), "Expected call hierarchy item to have a name");
146293
146311
  let text = isIdentifier(declName) ? idText(declName) : isStringOrNumericLiteralLike(declName) ? declName.text : isComputedPropertyName(declName) ? isStringOrNumericLiteralLike(declName.expression) ? declName.expression.text : void 0 : void 0;
146294
146312
  if (text === void 0) {
146295
146313
  const typeChecker = program.getTypeChecker();
@@ -146305,8 +146323,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146305
146323
  return { text, pos: declName.getStart(), end: declName.getEnd() };
146306
146324
  }
146307
146325
  function getCallHierarchItemContainerName(node) {
146308
- var _a, _b;
146309
- if (isConstNamedExpression(node)) {
146326
+ var _a, _b, _c, _d;
146327
+ if (isAssignedExpression(node)) {
146328
+ if (isPropertyDeclaration(node.parent) && isClassLike(node.parent.parent)) {
146329
+ return isClassExpression(node.parent.parent) ? (_a = getAssignedName(node.parent.parent)) == null ? void 0 : _a.getText() : (_b = node.parent.parent.name) == null ? void 0 : _b.getText();
146330
+ }
146310
146331
  if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier(node.parent.parent.parent.parent.parent.name)) {
146311
146332
  return node.parent.parent.parent.parent.parent.name.getText();
146312
146333
  }
@@ -146317,9 +146338,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146317
146338
  case 178 /* SetAccessor */:
146318
146339
  case 174 /* MethodDeclaration */:
146319
146340
  if (node.parent.kind === 210 /* ObjectLiteralExpression */) {
146320
- return (_a = getAssignedName(node.parent)) == null ? void 0 : _a.getText();
146341
+ return (_c = getAssignedName(node.parent)) == null ? void 0 : _c.getText();
146321
146342
  }
146322
- return (_b = getNameOfDeclaration(node.parent)) == null ? void 0 : _b.getText();
146343
+ return (_d = getNameOfDeclaration(node.parent)) == null ? void 0 : _d.getText();
146323
146344
  case 262 /* FunctionDeclaration */:
146324
146345
  case 263 /* ClassDeclaration */:
146325
146346
  case 267 /* ModuleDeclaration */:
@@ -146392,7 +146413,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146392
146413
  const ancestor = findAncestor(location.parent, isValidCallHierarchyDeclaration);
146393
146414
  return ancestor && findImplementationOrAllInitialDeclarations(typeChecker, ancestor);
146394
146415
  }
146395
- if (isVariableDeclaration(location.parent) && location.parent.initializer && isConstNamedExpression(location.parent.initializer)) {
146416
+ if (isVariableLike2(location.parent) && location.parent.initializer && isAssignedExpression(location.parent.initializer)) {
146396
146417
  return location.parent.initializer;
146397
146418
  }
146398
146419
  return void 0;
@@ -146407,7 +146428,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
146407
146428
  location = location.parent;
146408
146429
  continue;
146409
146430
  }
146410
- if (isVariableDeclaration(location) && location.initializer && isConstNamedExpression(location.initializer)) {
146431
+ if (isVariableDeclaration(location) && location.initializer && isAssignedExpression(location.initializer)) {
146411
146432
  return location.initializer;
146412
146433
  }
146413
146434
  if (!followingSymbol) {
@@ -152485,21 +152506,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
152485
152506
  const type = checker.getTypeAtLocation(member);
152486
152507
  return !!(type && type.flags & 402653316 /* StringLike */);
152487
152508
  });
152509
+ const sourceFile = parentDeclaration.getSourceFile();
152488
152510
  const enumMember = factory.createEnumMember(token, hasStringInitializer ? factory.createStringLiteral(token.text) : void 0);
152489
- changes.replaceNode(
152490
- parentDeclaration.getSourceFile(),
152491
- parentDeclaration,
152492
- factory.updateEnumDeclaration(
152493
- parentDeclaration,
152494
- parentDeclaration.modifiers,
152495
- parentDeclaration.name,
152496
- concatenate(parentDeclaration.members, singleElementArray(enumMember))
152497
- ),
152498
- {
152499
- leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll,
152500
- trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Exclude
152501
- }
152502
- );
152511
+ const last2 = lastOrUndefined(parentDeclaration.members);
152512
+ if (last2) {
152513
+ changes.insertNodeInListAfter(sourceFile, last2, enumMember, parentDeclaration.members);
152514
+ } else {
152515
+ changes.insertMemberAtStart(sourceFile, parentDeclaration, enumMember);
152516
+ }
152503
152517
  }
152504
152518
  function addFunctionDeclaration(changes, context, info) {
152505
152519
  const quotePreference = getQuotePreference(context.sourceFile, context.preferences);
@@ -152602,7 +152616,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
152602
152616
  /*enclosingDeclaration*/
152603
152617
  void 0,
152604
152618
  /*flags*/
152605
- void 0
152619
+ 64 /* UseFullyQualifiedType */
152606
152620
  );
152607
152621
  return enumMember === void 0 || name === void 0 ? factory.createNumericLiteral(0) : factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember));
152608
152622
  }
@@ -170137,7 +170151,7 @@ ${options.prefix}` : "\n" : options.prefix
170137
170151
  const afterMinusOneStartLinePosition = getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile);
170138
170152
  multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition;
170139
170153
  }
170140
- if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) {
170154
+ if (hasCommentsBeforeLineBreak(sourceFile.text, after.end) || !positionsAreOnSameLine(containingList.pos, containingList.end, sourceFile)) {
170141
170155
  multilineList = true;
170142
170156
  }
170143
170157
  if (multilineList) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20240101`;
57
+ var version = `${versionMajorMinor}.0-dev.20240103`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -25859,9 +25859,11 @@ var libEntries = [
25859
25859
  // Host only
25860
25860
  ["dom", "lib.dom.d.ts"],
25861
25861
  ["dom.iterable", "lib.dom.iterable.d.ts"],
25862
+ ["dom.asynciterable", "lib.dom.asynciterable.d.ts"],
25862
25863
  ["webworker", "lib.webworker.d.ts"],
25863
25864
  ["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
25864
25865
  ["webworker.iterable", "lib.webworker.iterable.d.ts"],
25866
+ ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
25865
25867
  ["scripthost", "lib.scripthost.d.ts"],
25866
25868
  // ES2015 Or ESNext By-feature options
25867
25869
  ["es2015.core", "lib.es2015.core.d.ts"],
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.4.0-dev.20240101",
5
+ "version": "5.4.0-dev.20240103",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "f2e9ebd1b7e6f8e11ab23631f7b2df4346708535"
116
+ "gitHead": "be20dbbbbb295b477660a9dee3e8a234b491b5fc"
117
117
  }