typescript 5.1.0-dev.20230309 → 5.1.0-dev.20230311

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.
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230309`;
38
+ version = `${versionMajorMinor}.0-dev.20230311`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -1620,7 +1620,7 @@ var ts = (() => {
1620
1620
  return s.slice(0, end + 1);
1621
1621
  }
1622
1622
  function isNodeLikeSystem() {
1623
- return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
1623
+ return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
1624
1624
  }
1625
1625
  var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart;
1626
1626
  var init_core = __esm({
@@ -6098,20 +6098,6 @@ ${lanes.join("\n")}
6098
6098
  (path2) => sys2.directoryExists(path2)
6099
6099
  );
6100
6100
  }
6101
- function getNodeMajorVersion() {
6102
- if (typeof process === "undefined") {
6103
- return void 0;
6104
- }
6105
- const version2 = process.version;
6106
- if (!version2) {
6107
- return void 0;
6108
- }
6109
- const dot = version2.indexOf(".");
6110
- if (dot === -1) {
6111
- return void 0;
6112
- }
6113
- return parseInt(version2.substring(1, dot));
6114
- }
6115
6101
  function setSys(s) {
6116
6102
  sys = s;
6117
6103
  }
@@ -6159,14 +6145,12 @@ ${lanes.join("\n")}
6159
6145
  let activeSession;
6160
6146
  let profilePath = "./profile.cpuprofile";
6161
6147
  const Buffer2 = require("buffer").Buffer;
6162
- const nodeVersion = getNodeMajorVersion();
6163
- const isNode4OrLater = nodeVersion >= 4;
6164
6148
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6165
6149
  const platform = _os.platform();
6166
6150
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
6167
6151
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6168
6152
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6169
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
6153
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6170
6154
  const getCurrentDirectory = memoize(() => process.cwd());
6171
6155
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6172
6156
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -6183,7 +6167,7 @@ ${lanes.join("\n")}
6183
6167
  getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
6184
6168
  realpath,
6185
6169
  tscWatchFile: process.env.TSC_WATCHFILE,
6186
- useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6170
+ useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
6187
6171
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6188
6172
  inodeWatching: isLinuxOrMacOs,
6189
6173
  sysLog
@@ -6269,8 +6253,10 @@ ${lanes.join("\n")}
6269
6253
  process.stdout.write("\x1Bc");
6270
6254
  },
6271
6255
  setBlocking: () => {
6272
- if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
6273
- process.stdout._handle.setBlocking(true);
6256
+ var _a2;
6257
+ const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
6258
+ if (handle && handle.setBlocking) {
6259
+ handle.setBlocking(true);
6274
6260
  }
6275
6261
  },
6276
6262
  bufferFrom,
@@ -38889,6 +38875,10 @@ ${lanes.join("\n")}
38889
38875
  originalPath: pathsAreEqual ? void 0 : fileName
38890
38876
  };
38891
38877
  }
38878
+ function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
38879
+ const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
38880
+ return combinePaths(typeRoot, nameForLookup);
38881
+ }
38892
38882
  function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
38893
38883
  Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
38894
38884
  const traceEnabled = isTraceEnabled(options, host);
@@ -39007,7 +38997,7 @@ ${lanes.join("\n")}
39007
38997
  trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
39008
38998
  }
39009
38999
  return firstDefined(typeRoots, (typeRoot) => {
39010
- const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
39000
+ const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
39011
39001
  const directoryExists = directoryProbablyExists(typeRoot, host);
39012
39002
  if (!directoryExists && traceEnabled) {
39013
39003
  trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -41117,7 +41107,7 @@ ${lanes.join("\n")}
41117
41107
  if (!state.compilerOptions.typeRoots)
41118
41108
  return;
41119
41109
  for (const typeRoot of state.compilerOptions.typeRoots) {
41120
- const candidate = combinePaths(typeRoot, moduleName);
41110
+ const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
41121
41111
  const directoryExists = directoryProbablyExists(typeRoot, state.host);
41122
41112
  if (!directoryExists && state.traceEnabled) {
41123
41113
  trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -55080,10 +55070,9 @@ ${lanes.join("\n")}
55080
55070
  return [sig.parameters];
55081
55071
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55082
55072
  const elementTypes = getTypeArguments(restType);
55083
- const associatedNames = restType.target.labeledElementDeclarations;
55073
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55084
55074
  const restParams = map(elementTypes, (t, i) => {
55085
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
55086
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
55075
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55087
55076
  const flags = restType.target.elementFlags[i];
55088
55077
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
55089
55078
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -55092,6 +55081,20 @@ ${lanes.join("\n")}
55092
55081
  });
55093
55082
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55094
55083
  }
55084
+ function getUniqAssociatedNamesFromTupleType(type) {
55085
+ const associatedNamesMap = /* @__PURE__ */ new Map();
55086
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55087
+ const name = getTupleElementLabel(labeledElement);
55088
+ const prevCounter = associatedNamesMap.get(name);
55089
+ if (prevCounter === void 0) {
55090
+ associatedNamesMap.set(name, 1);
55091
+ return name;
55092
+ } else {
55093
+ associatedNamesMap.set(name, prevCounter + 1);
55094
+ return `${name}_${prevCounter}`;
55095
+ }
55096
+ });
55097
+ }
55095
55098
  }
55096
55099
  function getDefaultConstructSignatures(classType) {
55097
55100
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -61049,20 +61052,8 @@ ${lanes.join("\n")}
61049
61052
  return result;
61050
61053
  }
61051
61054
  const moreThanOneRealChildren = length(validChildren) > 1;
61052
- let arrayLikeTargetParts;
61053
- let nonArrayLikeTargetParts;
61054
- const iterableType = getGlobalIterableType(
61055
- /*reportErrors*/
61056
- false
61057
- );
61058
- if (iterableType !== emptyGenericType) {
61059
- const anyIterable = createIterableType(anyType);
61060
- arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
61061
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
61062
- } else {
61063
- arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
61064
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
61065
- }
61055
+ const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
61056
+ const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
61066
61057
  if (moreThanOneRealChildren) {
61067
61058
  if (arrayLikeTargetParts !== neverType) {
61068
61059
  const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
@@ -64348,6 +64339,13 @@ ${lanes.join("\n")}
64348
64339
  function isArrayOrTupleLikeType(type) {
64349
64340
  return isArrayLikeType(type) || isTupleLikeType(type);
64350
64341
  }
64342
+ function isAssignableToAvailableAnyIterable(type) {
64343
+ const anyIterable = getGlobalIterableType(
64344
+ /*reportErrors*/
64345
+ false
64346
+ ) !== emptyGenericType && createIterableType(anyType);
64347
+ return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
64348
+ }
64351
64349
  function getTupleElementType(type, index) {
64352
64350
  const propType = getTypeOfPropertyOfType(type, "" + index);
64353
64351
  if (propType) {
@@ -69101,7 +69099,7 @@ ${lanes.join("\n")}
69101
69099
  return void 0;
69102
69100
  }
69103
69101
  function getContextualTypeForElementExpression(arrayContextualType, index) {
69104
- return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
69102
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
69105
69103
  arrayContextualType,
69106
69104
  (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
69107
69105
  t,
@@ -142576,9 +142574,10 @@ ${lanes.join("\n")}
142576
142574
  if (!isMemberName(token))
142577
142575
  return void 0;
142578
142576
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
142577
+ const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
142579
142578
  const properties = arrayFrom(checker.getUnmatchedProperties(
142580
142579
  checker.getTypeAtLocation(parent2.initializer),
142581
- checker.getTypeAtLocation(token),
142580
+ targetType,
142582
142581
  /* requireOptionalProperties */
142583
142582
  false,
142584
142583
  /* matchDiscriminantProperties */
@@ -179476,7 +179475,6 @@ ${e.message}`;
179476
179475
  getNodeForGeneratedName: () => getNodeForGeneratedName,
179477
179476
  getNodeId: () => getNodeId,
179478
179477
  getNodeKind: () => getNodeKind,
179479
- getNodeMajorVersion: () => getNodeMajorVersion,
179480
179478
  getNodeModifiers: () => getNodeModifiers,
179481
179479
  getNodeModulePathParts: () => getNodeModulePathParts,
179482
179480
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -181833,7 +181831,6 @@ ${e.message}`;
181833
181831
  getNodeForGeneratedName: () => getNodeForGeneratedName,
181834
181832
  getNodeId: () => getNodeId,
181835
181833
  getNodeKind: () => getNodeKind,
181836
- getNodeMajorVersion: () => getNodeMajorVersion,
181837
181834
  getNodeModifiers: () => getNodeModifiers,
181838
181835
  getNodeModulePathParts: () => getNodeModulePathParts,
181839
181836
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -4342,7 +4342,6 @@ declare namespace ts {
4342
4342
  negative: boolean;
4343
4343
  base10Value: string;
4344
4344
  }
4345
- function getNodeMajorVersion(): number | undefined;
4346
4345
  enum FileWatcherEventKind {
4347
4346
  Created = 0,
4348
4347
  Changed = 1,
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.1";
38
- version = `${versionMajorMinor}.0-dev.20230309`;
38
+ version = `${versionMajorMinor}.0-dev.20230311`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -1620,7 +1620,7 @@ var ts = (() => {
1620
1620
  return s.slice(0, end + 1);
1621
1621
  }
1622
1622
  function isNodeLikeSystem() {
1623
- return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
1623
+ return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
1624
1624
  }
1625
1625
  var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart;
1626
1626
  var init_core = __esm({
@@ -6098,20 +6098,6 @@ ${lanes.join("\n")}
6098
6098
  (path2) => sys2.directoryExists(path2)
6099
6099
  );
6100
6100
  }
6101
- function getNodeMajorVersion() {
6102
- if (typeof process === "undefined") {
6103
- return void 0;
6104
- }
6105
- const version2 = process.version;
6106
- if (!version2) {
6107
- return void 0;
6108
- }
6109
- const dot = version2.indexOf(".");
6110
- if (dot === -1) {
6111
- return void 0;
6112
- }
6113
- return parseInt(version2.substring(1, dot));
6114
- }
6115
6101
  function setSys(s) {
6116
6102
  sys = s;
6117
6103
  }
@@ -6159,14 +6145,12 @@ ${lanes.join("\n")}
6159
6145
  let activeSession;
6160
6146
  let profilePath = "./profile.cpuprofile";
6161
6147
  const Buffer2 = require("buffer").Buffer;
6162
- const nodeVersion = getNodeMajorVersion();
6163
- const isNode4OrLater = nodeVersion >= 4;
6164
6148
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6165
6149
  const platform = _os.platform();
6166
6150
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
6167
6151
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6168
6152
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6169
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
6153
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6170
6154
  const getCurrentDirectory = memoize(() => process.cwd());
6171
6155
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6172
6156
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -6183,7 +6167,7 @@ ${lanes.join("\n")}
6183
6167
  getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
6184
6168
  realpath,
6185
6169
  tscWatchFile: process.env.TSC_WATCHFILE,
6186
- useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
6170
+ useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
6187
6171
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6188
6172
  inodeWatching: isLinuxOrMacOs,
6189
6173
  sysLog
@@ -6269,8 +6253,10 @@ ${lanes.join("\n")}
6269
6253
  process.stdout.write("\x1Bc");
6270
6254
  },
6271
6255
  setBlocking: () => {
6272
- if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
6273
- process.stdout._handle.setBlocking(true);
6256
+ var _a2;
6257
+ const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
6258
+ if (handle && handle.setBlocking) {
6259
+ handle.setBlocking(true);
6274
6260
  }
6275
6261
  },
6276
6262
  bufferFrom,
@@ -38889,6 +38875,10 @@ ${lanes.join("\n")}
38889
38875
  originalPath: pathsAreEqual ? void 0 : fileName
38890
38876
  };
38891
38877
  }
38878
+ function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
38879
+ const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
38880
+ return combinePaths(typeRoot, nameForLookup);
38881
+ }
38892
38882
  function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
38893
38883
  Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
38894
38884
  const traceEnabled = isTraceEnabled(options, host);
@@ -39007,7 +38997,7 @@ ${lanes.join("\n")}
39007
38997
  trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
39008
38998
  }
39009
38999
  return firstDefined(typeRoots, (typeRoot) => {
39010
- const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
39000
+ const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
39011
39001
  const directoryExists = directoryProbablyExists(typeRoot, host);
39012
39002
  if (!directoryExists && traceEnabled) {
39013
39003
  trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -41117,7 +41107,7 @@ ${lanes.join("\n")}
41117
41107
  if (!state.compilerOptions.typeRoots)
41118
41108
  return;
41119
41109
  for (const typeRoot of state.compilerOptions.typeRoots) {
41120
- const candidate = combinePaths(typeRoot, moduleName);
41110
+ const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
41121
41111
  const directoryExists = directoryProbablyExists(typeRoot, state.host);
41122
41112
  if (!directoryExists && state.traceEnabled) {
41123
41113
  trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
@@ -55080,10 +55070,9 @@ ${lanes.join("\n")}
55080
55070
  return [sig.parameters];
55081
55071
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55082
55072
  const elementTypes = getTypeArguments(restType);
55083
- const associatedNames = restType.target.labeledElementDeclarations;
55073
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55084
55074
  const restParams = map(elementTypes, (t, i) => {
55085
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
55086
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
55075
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55087
55076
  const flags = restType.target.elementFlags[i];
55088
55077
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
55089
55078
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -55092,6 +55081,20 @@ ${lanes.join("\n")}
55092
55081
  });
55093
55082
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55094
55083
  }
55084
+ function getUniqAssociatedNamesFromTupleType(type) {
55085
+ const associatedNamesMap = /* @__PURE__ */ new Map();
55086
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55087
+ const name = getTupleElementLabel(labeledElement);
55088
+ const prevCounter = associatedNamesMap.get(name);
55089
+ if (prevCounter === void 0) {
55090
+ associatedNamesMap.set(name, 1);
55091
+ return name;
55092
+ } else {
55093
+ associatedNamesMap.set(name, prevCounter + 1);
55094
+ return `${name}_${prevCounter}`;
55095
+ }
55096
+ });
55097
+ }
55095
55098
  }
55096
55099
  function getDefaultConstructSignatures(classType) {
55097
55100
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -61049,20 +61052,8 @@ ${lanes.join("\n")}
61049
61052
  return result;
61050
61053
  }
61051
61054
  const moreThanOneRealChildren = length(validChildren) > 1;
61052
- let arrayLikeTargetParts;
61053
- let nonArrayLikeTargetParts;
61054
- const iterableType = getGlobalIterableType(
61055
- /*reportErrors*/
61056
- false
61057
- );
61058
- if (iterableType !== emptyGenericType) {
61059
- const anyIterable = createIterableType(anyType);
61060
- arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
61061
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
61062
- } else {
61063
- arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
61064
- nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
61065
- }
61055
+ const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
61056
+ const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
61066
61057
  if (moreThanOneRealChildren) {
61067
61058
  if (arrayLikeTargetParts !== neverType) {
61068
61059
  const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
@@ -64348,6 +64339,13 @@ ${lanes.join("\n")}
64348
64339
  function isArrayOrTupleLikeType(type) {
64349
64340
  return isArrayLikeType(type) || isTupleLikeType(type);
64350
64341
  }
64342
+ function isAssignableToAvailableAnyIterable(type) {
64343
+ const anyIterable = getGlobalIterableType(
64344
+ /*reportErrors*/
64345
+ false
64346
+ ) !== emptyGenericType && createIterableType(anyType);
64347
+ return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
64348
+ }
64351
64349
  function getTupleElementType(type, index) {
64352
64350
  const propType = getTypeOfPropertyOfType(type, "" + index);
64353
64351
  if (propType) {
@@ -69101,7 +69099,7 @@ ${lanes.join("\n")}
69101
69099
  return void 0;
69102
69100
  }
69103
69101
  function getContextualTypeForElementExpression(arrayContextualType, index) {
69104
- return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
69102
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
69105
69103
  arrayContextualType,
69106
69104
  (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
69107
69105
  t,
@@ -142590,9 +142588,10 @@ ${lanes.join("\n")}
142590
142588
  if (!isMemberName(token))
142591
142589
  return void 0;
142592
142590
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
142591
+ const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
142593
142592
  const properties = arrayFrom(checker.getUnmatchedProperties(
142594
142593
  checker.getTypeAtLocation(parent2.initializer),
142595
- checker.getTypeAtLocation(token),
142594
+ targetType,
142596
142595
  /* requireOptionalProperties */
142597
142596
  false,
142598
142597
  /* matchDiscriminantProperties */
@@ -168644,7 +168643,6 @@ ${options.prefix}` : "\n" : options.prefix
168644
168643
  getNodeForGeneratedName: () => getNodeForGeneratedName,
168645
168644
  getNodeId: () => getNodeId,
168646
168645
  getNodeKind: () => getNodeKind,
168647
- getNodeMajorVersion: () => getNodeMajorVersion,
168648
168646
  getNodeModifiers: () => getNodeModifiers,
168649
168647
  getNodeModulePathParts: () => getNodeModulePathParts,
168650
168648
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230309`;
57
+ var version = `${versionMajorMinor}.0-dev.20230311`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -841,7 +841,7 @@ function trimEndImpl(s) {
841
841
  return s.slice(0, end + 1);
842
842
  }
843
843
  function isNodeLikeSystem() {
844
- return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
844
+ return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
845
845
  }
846
846
 
847
847
  // src/compiler/debug.ts
@@ -4264,20 +4264,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
4264
4264
  (path3) => sys2.directoryExists(path3)
4265
4265
  );
4266
4266
  }
4267
- function getNodeMajorVersion() {
4268
- if (typeof process === "undefined") {
4269
- return void 0;
4270
- }
4271
- const version2 = process.version;
4272
- if (!version2) {
4273
- return void 0;
4274
- }
4275
- const dot = version2.indexOf(".");
4276
- if (dot === -1) {
4277
- return void 0;
4278
- }
4279
- return parseInt(version2.substring(1, dot));
4280
- }
4281
4267
  var sys = (() => {
4282
4268
  const byteOrderMarkIndicator = "\uFEFF";
4283
4269
  function getNodeSystem() {
@@ -4294,14 +4280,12 @@ var sys = (() => {
4294
4280
  let activeSession;
4295
4281
  let profilePath = "./profile.cpuprofile";
4296
4282
  const Buffer2 = require("buffer").Buffer;
4297
- const nodeVersion = getNodeMajorVersion();
4298
- const isNode4OrLater = nodeVersion >= 4;
4299
4283
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4300
4284
  const platform = _os.platform();
4301
4285
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
4302
4286
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4303
4287
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4304
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
4288
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4305
4289
  const getCurrentDirectory = memoize(() => process.cwd());
4306
4290
  const { watchFile, watchDirectory } = createSystemWatchFunctions({
4307
4291
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -4318,7 +4302,7 @@ var sys = (() => {
4318
4302
  getAccessibleSortedChildDirectories: (path2) => getAccessibleFileSystemEntries(path2).directories,
4319
4303
  realpath,
4320
4304
  tscWatchFile: process.env.TSC_WATCHFILE,
4321
- useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
4305
+ useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4322
4306
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4323
4307
  inodeWatching: isLinuxOrMacOs,
4324
4308
  sysLog
@@ -4404,8 +4388,10 @@ var sys = (() => {
4404
4388
  process.stdout.write("\x1Bc");
4405
4389
  },
4406
4390
  setBlocking: () => {
4407
- if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) {
4408
- process.stdout._handle.setBlocking(true);
4391
+ var _a2;
4392
+ const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
4393
+ if (handle && handle.setBlocking) {
4394
+ handle.setBlocking(true);
4409
4395
  }
4410
4396
  },
4411
4397
  bufferFrom,
@@ -27334,6 +27320,10 @@ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
27334
27320
  originalPath: pathsAreEqual ? void 0 : fileName
27335
27321
  };
27336
27322
  }
27323
+ function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
27324
+ const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
27325
+ return combinePaths(typeRoot, nameForLookup);
27326
+ }
27337
27327
  function getNodeResolutionFeatures(options) {
27338
27328
  let features = 0 /* None */;
27339
27329
  switch (getEmitModuleResolutionKind(options)) {
@@ -28843,7 +28833,7 @@ function resolveFromTypeRoot(moduleName, state) {
28843
28833
  if (!state.compilerOptions.typeRoots)
28844
28834
  return;
28845
28835
  for (const typeRoot of state.compilerOptions.typeRoots) {
28846
- const candidate = combinePaths(typeRoot, moduleName);
28836
+ const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
28847
28837
  const directoryExists = directoryProbablyExists(typeRoot, state.host);
28848
28838
  if (!directoryExists && state.traceEnabled) {
28849
28839
  trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
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.1.0-dev.20230309",
5
+ "version": "5.1.0-dev.20230311",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  "tsserver": "./bin/tsserver"
27
27
  },
28
28
  "engines": {
29
- "node": ">=4.2.0"
29
+ "node": ">=12.20"
30
30
  },
31
31
  "files": [
32
32
  "bin",
@@ -112,5 +112,5 @@
112
112
  "node": "14.21.1",
113
113
  "npm": "8.19.3"
114
114
  },
115
- "gitHead": "d681520a14edf78560de2b098d6d68783e2fdd8d"
115
+ "gitHead": "041b0db8f4dd69a20a08ca5ec9cfb166dff46adb"
116
116
  }