typescript 5.1.0-dev.20230412 → 5.1.0-dev.20230414

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.
@@ -6594,6 +6594,7 @@ declare namespace ts {
6594
6594
  readonly insertSpaceBeforeTypeAnnotation?: boolean;
6595
6595
  readonly indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
6596
6596
  readonly semicolons?: SemicolonPreference;
6597
+ readonly indentSwitchCase?: boolean;
6597
6598
  }
6598
6599
  interface DefinitionInfo extends DocumentSpan {
6599
6600
  kind: ScriptElementKind;
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.20230412`;
38
+ version = `${versionMajorMinor}.0-dev.20230414`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6737,11 +6737,11 @@ ${lanes.join("\n")}
6737
6737
  path = combinePaths(currentDirectory, path);
6738
6738
  return pathComponents(path, getRootLength(path));
6739
6739
  }
6740
- function getPathFromPathComponents(pathComponents2) {
6740
+ function getPathFromPathComponents(pathComponents2, length2) {
6741
6741
  if (pathComponents2.length === 0)
6742
6742
  return "";
6743
6743
  const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
6744
- return root + pathComponents2.slice(1).join(directorySeparator);
6744
+ return root + pathComponents2.slice(1, length2).join(directorySeparator);
6745
6745
  }
6746
6746
  function normalizeSlashes(path) {
6747
6747
  return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path;
@@ -20595,7 +20595,7 @@ ${lanes.join("\n")}
20595
20595
  function createBigIntLiteral(value) {
20596
20596
  const node = createBaseToken(10 /* BigIntLiteral */);
20597
20597
  node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
20598
- node.transformFlags |= 4 /* ContainsESNext */;
20598
+ node.transformFlags |= 32 /* ContainsES2020 */;
20599
20599
  return node;
20600
20600
  }
20601
20601
  function createBaseStringLiteral(text, isSingleQuote) {
@@ -22105,7 +22105,7 @@ ${lanes.join("\n")}
22105
22105
  node.transformFlags |= 1024 /* ContainsES2015 */;
22106
22106
  break;
22107
22107
  case 102 /* ImportKeyword */:
22108
- node.transformFlags |= 4 /* ContainsESNext */;
22108
+ node.transformFlags |= 32 /* ContainsES2020 */;
22109
22109
  break;
22110
22110
  default:
22111
22111
  return Debug.assertNever(keywordToken);
@@ -22633,7 +22633,7 @@ ${lanes.join("\n")}
22633
22633
  function createNamespaceExport(name) {
22634
22634
  const node = createBaseDeclaration(279 /* NamespaceExport */);
22635
22635
  node.name = name;
22636
- node.transformFlags |= propagateChildFlags(node.name) | 4 /* ContainsESNext */;
22636
+ node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
22637
22637
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
22638
22638
  return node;
22639
22639
  }
@@ -47200,11 +47200,6 @@ ${lanes.join("\n")}
47200
47200
  diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
47201
47201
  } else if (result.flags & 256 /* RegularEnum */) {
47202
47202
  diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
47203
- } else {
47204
- Debug.assert(!!(result.flags & 128 /* ConstEnum */));
47205
- if (shouldPreserveConstEnums(compilerOptions)) {
47206
- diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
47207
- }
47208
47203
  }
47209
47204
  if (diagnosticMessage) {
47210
47205
  addRelatedInfo(
@@ -64032,40 +64027,31 @@ ${lanes.join("\n")}
64032
64027
  return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp)));
64033
64028
  }
64034
64029
  function getBestMatchingType(source, target, isRelatedTo = compareTypesAssignable) {
64035
- return findMatchingDiscriminantType(
64036
- source,
64037
- target,
64038
- isRelatedTo,
64039
- /*skipPartial*/
64040
- true
64041
- ) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target);
64030
+ return findMatchingDiscriminantType(source, target, isRelatedTo) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target);
64042
64031
  }
64043
- function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue, skipPartial) {
64044
- const discriminable = target.types.map((_) => void 0);
64032
+ function discriminateTypeByDiscriminableItems(target, discriminators, related) {
64033
+ const types = target.types;
64034
+ const include = types.map((t) => t.flags & 402784252 /* Primitive */ ? 0 /* False */ : -1 /* True */);
64045
64035
  for (const [getDiscriminatingType, propertyName] of discriminators) {
64046
- const targetProp = getUnionOrIntersectionProperty(target, propertyName);
64047
- if (skipPartial && targetProp && getCheckFlags(targetProp) & 16 /* ReadPartial */) {
64048
- continue;
64036
+ let matched = false;
64037
+ for (let i = 0; i < types.length; i++) {
64038
+ if (include[i]) {
64039
+ const targetType = getTypeOfPropertyOfType(types[i], propertyName);
64040
+ if (targetType && related(getDiscriminatingType(), targetType)) {
64041
+ matched = true;
64042
+ } else {
64043
+ include[i] = 3 /* Maybe */;
64044
+ }
64045
+ }
64049
64046
  }
64050
- let i = 0;
64051
- for (const type of target.types) {
64052
- const targetType = getTypeOfPropertyOfType(type, propertyName);
64053
- if (targetType && related(getDiscriminatingType(), targetType)) {
64054
- discriminable[i] = discriminable[i] === void 0 ? true : discriminable[i];
64055
- } else {
64056
- discriminable[i] = false;
64047
+ for (let i = 0; i < types.length; i++) {
64048
+ if (include[i] === 3 /* Maybe */) {
64049
+ include[i] = matched ? 0 /* False */ : -1 /* True */;
64057
64050
  }
64058
- i++;
64059
64051
  }
64060
64052
  }
64061
- const match = discriminable.indexOf(
64062
- /*searchElement*/
64063
- true
64064
- );
64065
- if (match === -1) {
64066
- return defaultValue;
64067
- }
64068
- return getUnionType(target.types.filter((_, index) => discriminable[index]));
64053
+ const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
64054
+ return filtered.flags & 131072 /* Never */ ? target : filtered;
64069
64055
  }
64070
64056
  function isWeakType(type) {
64071
64057
  if (type.flags & 524288 /* Object */) {
@@ -69369,8 +69355,7 @@ ${lanes.join("\n")}
69369
69355
  (s) => [() => undefinedType, s.escapedName]
69370
69356
  )
69371
69357
  ),
69372
- isTypeAssignableTo,
69373
- contextualType
69358
+ isTypeAssignableTo
69374
69359
  );
69375
69360
  }
69376
69361
  function discriminateContextualTypeByJSXAttributes(node, contextualType) {
@@ -69389,8 +69374,7 @@ ${lanes.join("\n")}
69389
69374
  (s) => [() => undefinedType, s.escapedName]
69390
69375
  )
69391
69376
  ),
69392
- isTypeAssignableTo,
69393
- contextualType
69377
+ isTypeAssignableTo
69394
69378
  );
69395
69379
  }
69396
69380
  function getApparentTypeOfContextualType(node, contextFlags) {
@@ -85404,7 +85388,7 @@ ${lanes.join("\n")}
85404
85388
  }
85405
85389
  return type;
85406
85390
  }
85407
- function findMatchingDiscriminantType(source, target, isRelatedTo, skipPartial) {
85391
+ function findMatchingDiscriminantType(source, target, isRelatedTo) {
85408
85392
  if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
85409
85393
  const match = getMatchingUnionConstituentForType(target, source);
85410
85394
  if (match) {
@@ -85414,14 +85398,10 @@ ${lanes.join("\n")}
85414
85398
  if (sourceProperties) {
85415
85399
  const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
85416
85400
  if (sourcePropertiesFiltered) {
85417
- return discriminateTypeByDiscriminableItems(
85418
- target,
85419
- map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]),
85420
- isRelatedTo,
85421
- /*defaultValue*/
85422
- void 0,
85423
- skipPartial
85424
- );
85401
+ const discriminated = discriminateTypeByDiscriminableItems(target, map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]), isRelatedTo);
85402
+ if (discriminated !== target) {
85403
+ return discriminated;
85404
+ }
85425
85405
  }
85426
85406
  }
85427
85407
  }
@@ -121201,60 +121181,62 @@ ${lanes.join("\n")}
121201
121181
  }
121202
121182
  return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
121203
121183
  }
121204
- function canWatchDirectoryOrFile(dirPath) {
121205
- const rootLength = getRootLength(dirPath);
121206
- if (dirPath.length === rootLength) {
121207
- return false;
121208
- }
121209
- let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength);
121210
- if (nextDirectorySeparator === -1) {
121211
- return false;
121212
- }
121213
- let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
121214
- const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */;
121215
- if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
121216
- pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
121217
- nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
121218
- if (nextDirectorySeparator === -1) {
121219
- return false;
121220
- }
121221
- pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
121184
+ function perceivedOsRootLengthForWatching(pathComponents2, length2) {
121185
+ if (length2 <= 1)
121186
+ return 1;
121187
+ let userCheckIndex = 1;
121188
+ let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
121189
+ if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
121190
+ pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
121191
+ if (length2 === 2)
121192
+ return 2;
121193
+ userCheckIndex = 2;
121194
+ isDosStyle = true;
121222
121195
  }
121223
- if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
121224
- return true;
121196
+ if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
121197
+ return userCheckIndex;
121225
121198
  }
121226
- for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
121227
- searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1;
121228
- if (searchIndex === 0) {
121229
- return false;
121230
- }
121231
- }
121232
- return true;
121199
+ return userCheckIndex + 2;
121200
+ }
121201
+ function canWatchDirectoryOrFile(pathComponents2, length2) {
121202
+ if (length2 === void 0)
121203
+ length2 = pathComponents2.length;
121204
+ if (length2 <= 2)
121205
+ return false;
121206
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
121207
+ return length2 > perceivedOsRootLength + 1;
121233
121208
  }
121234
- function canWatchAtTypes(atTypes, rootPath) {
121235
- const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
121236
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
121209
+ function canWatchAtTypes(atTypes) {
121210
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
121237
121211
  }
121238
- function isInDirectoryPath(dir, file) {
121239
- if (dir === void 0 || file.length <= dir.length) {
121212
+ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
121213
+ if (fileOrDirComponents.length < fileOrDirComponents.length)
121240
121214
  return false;
121215
+ for (let i = 0; i < dirComponents.length; i++) {
121216
+ if (fileOrDirComponents[i] !== dirComponents[i])
121217
+ return false;
121241
121218
  }
121242
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
121219
+ return true;
121220
+ }
121221
+ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
121222
+ return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
121243
121223
  }
121244
121224
  function canWatchAffectingLocation(filePath) {
121245
- return canWatchDirectoryOrFile(filePath);
121246
- }
121247
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
121248
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
121249
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
121250
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
121251
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
121252
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
121253
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
121254
- return {
121255
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
121256
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
121257
- };
121225
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
121226
+ }
121227
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
121228
+ const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
121229
+ failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
121230
+ const failedLookupComponents = getPathComponents(failedLookupLocation);
121231
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(failedLookupPathComponents, failedLookupPathComponents.length);
121232
+ if (failedLookupPathComponents.length <= perceivedOsRootLength + 1)
121233
+ return void 0;
121234
+ const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
121235
+ if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
121236
+ return void 0;
121237
+ if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
121238
+ if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
121239
+ return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1));
121258
121240
  } else {
121259
121241
  return {
121260
121242
  dir: rootDir,
@@ -121264,45 +121246,58 @@ ${lanes.join("\n")}
121264
121246
  }
121265
121247
  }
121266
121248
  return getDirectoryToWatchFromFailedLookupLocationDirectory(
121267
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
121268
- getDirectoryPath(failedLookupLocationPath),
121269
- rootPath
121249
+ failedLookupComponents,
121250
+ failedLookupPathComponents,
121251
+ failedLookupPathComponents.length - 1,
121252
+ perceivedOsRootLength,
121253
+ nodeModulesIndex,
121254
+ rootPathComponents
121270
121255
  );
121271
121256
  }
121272
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
121273
- while (pathContainsNodeModules(dirPath)) {
121274
- dir = getDirectoryPath(dir);
121275
- dirPath = getDirectoryPath(dirPath);
121276
- }
121277
- if (isNodeModulesDirectory(dirPath)) {
121278
- return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
121257
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
121258
+ if (nodeModulesIndex !== -1) {
121259
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, nodeModulesIndex + 1);
121279
121260
  }
121280
121261
  let nonRecursive = true;
121281
- let subDirectoryPath, subDirectory;
121282
- if (rootPath !== void 0) {
121283
- while (!isInDirectoryPath(dirPath, rootPath)) {
121284
- const parentPath = getDirectoryPath(dirPath);
121285
- if (parentPath === dirPath) {
121286
- break;
121287
- }
121262
+ let length2 = dirPathComponentsLength;
121263
+ for (let i = 0; i < dirPathComponentsLength; i++) {
121264
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
121288
121265
  nonRecursive = false;
121289
- subDirectoryPath = dirPath;
121290
- subDirectory = dir;
121291
- dirPath = parentPath;
121292
- dir = getDirectoryPath(dir);
121266
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
121267
+ break;
121293
121268
  }
121294
121269
  }
121295
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
121270
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive);
121271
+ }
121272
+ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
121273
+ return {
121274
+ dir: getPathFromPathComponents(dirComponents, length2),
121275
+ dirPath: getPathFromPathComponents(dirPathComponents, length2),
121276
+ nonRecursive
121277
+ };
121296
121278
  }
121297
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
121298
- if (isInDirectoryPath(rootPath, typeRootPath)) {
121279
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
121280
+ const typeRootPathComponents = getPathComponents(typeRootPath);
121281
+ if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
121299
121282
  return rootPath;
121300
121283
  }
121301
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
121284
+ typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
121285
+ const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
121286
+ getPathComponents(typeRoot),
121287
+ typeRootPathComponents,
121288
+ typeRootPathComponents.length,
121289
+ perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
121290
+ typeRootPathComponents.indexOf("node_modules"),
121291
+ rootPathComponents
121292
+ );
121302
121293
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
121303
121294
  }
121304
121295
  function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
121305
- return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
121296
+ const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
121297
+ return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
121298
+ }
121299
+ function getRootPathSplitLength(rootPath) {
121300
+ return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
121306
121301
  }
121307
121302
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
121308
121303
  let filesWithChangedSetOfUnresolvedImports;
@@ -121334,13 +121329,11 @@ ${lanes.join("\n")}
121334
121329
  resolutionHost.getCompilationSettings(),
121335
121330
  moduleResolutionCache.getPackageJsonInfoCache()
121336
121331
  );
121337
- const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
121338
- const customFailedLookupPaths = /* @__PURE__ */ new Map();
121339
121332
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
121340
121333
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
121341
121334
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
121342
- const rootPath = rootDir && resolutionHost.toPath(rootDir);
121343
- const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
121335
+ const rootPath = resolutionHost.toPath(rootDir);
121336
+ const rootPathComponents = getPathComponents(rootPath);
121344
121337
  const typeRootsWatches = /* @__PURE__ */ new Map();
121345
121338
  return {
121346
121339
  getModuleResolutionCache: () => moduleResolutionCache,
@@ -121374,7 +121367,6 @@ ${lanes.join("\n")}
121374
121367
  function clear2() {
121375
121368
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
121376
121369
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
121377
- customFailedLookupPaths.clear();
121378
121370
  nonRelativeExternalModuleResolutions.clear();
121379
121371
  closeTypeRootsWatch();
121380
121372
  resolvedModuleNames.clear();
@@ -121654,9 +121646,6 @@ ${lanes.join("\n")}
121654
121646
  function isNodeModulesAtTypesDirectory(dirPath) {
121655
121647
  return endsWith(dirPath, "/node_modules/@types");
121656
121648
  }
121657
- function isPathWithDefaultFailedLookupExtension(path) {
121658
- return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
121659
- }
121660
121649
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
121661
121650
  var _a2, _b;
121662
121651
  if (resolution.refCount) {
@@ -121697,15 +121686,11 @@ ${lanes.join("\n")}
121697
121686
  failedLookupLocationPath,
121698
121687
  rootDir,
121699
121688
  rootPath,
121700
- rootSplitLength,
121689
+ rootPathComponents,
121701
121690
  getCurrentDirectory
121702
121691
  );
121703
121692
  if (toWatch) {
121704
121693
  const { dir, dirPath, nonRecursive } = toWatch;
121705
- if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
121706
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
121707
- customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
121708
- }
121709
121694
  if (dirPath === rootPath) {
121710
121695
  Debug.assert(nonRecursive);
121711
121696
  setAtRoot = true;
@@ -121840,20 +121825,11 @@ ${lanes.join("\n")}
121840
121825
  failedLookupLocationPath,
121841
121826
  rootDir,
121842
121827
  rootPath,
121843
- rootSplitLength,
121828
+ rootPathComponents,
121844
121829
  getCurrentDirectory
121845
121830
  );
121846
121831
  if (toWatch) {
121847
121832
  const { dirPath } = toWatch;
121848
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
121849
- if (refCount) {
121850
- if (refCount === 1) {
121851
- customFailedLookupPaths.delete(failedLookupLocationPath);
121852
- } else {
121853
- Debug.assert(refCount > 1);
121854
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
121855
- }
121856
- }
121857
121833
  if (dirPath === rootPath) {
121858
121834
  removeAtRoot = true;
121859
121835
  } else {
@@ -121951,10 +121927,10 @@ ${lanes.join("\n")}
121951
121927
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121952
121928
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121953
121929
  } else {
121954
- if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
121930
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121955
121931
  return false;
121956
121932
  }
121957
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121933
+ if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
121958
121934
  return false;
121959
121935
  }
121960
121936
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -122001,7 +121977,7 @@ ${lanes.join("\n")}
122001
121977
  return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
122002
121978
  }
122003
121979
  function isInvalidatedFailedLookup(locationPath) {
122004
- return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
121980
+ return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
122005
121981
  }
122006
121982
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
122007
121983
  var _a2;
@@ -122022,6 +121998,8 @@ ${lanes.join("\n")}
122022
121998
  typeRoot,
122023
121999
  typeRootPath,
122024
122000
  rootPath,
122001
+ rootPathComponents,
122002
+ getCurrentDirectory,
122025
122003
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
122026
122004
  );
122027
122005
  if (dirPath) {
@@ -122052,7 +122030,7 @@ ${lanes.join("\n")}
122052
122030
  function canWatchTypeRootPath(typeRoot) {
122053
122031
  if (resolutionHost.getCompilationSettings().typeRoots)
122054
122032
  return true;
122055
- return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
122033
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot));
122056
122034
  }
122057
122035
  }
122058
122036
  function resolutionIsSymlink(resolution) {
@@ -125997,7 +125975,8 @@ ${lanes.join("\n")}
125997
125975
  placeOpenBraceOnNewLineForFunctions: false,
125998
125976
  placeOpenBraceOnNewLineForControlBlocks: false,
125999
125977
  semicolons: "ignore" /* Ignore */,
126000
- trimTrailingWhitespace: true
125978
+ trimTrailingWhitespace: true,
125979
+ indentSwitchCase: true
126001
125980
  };
126002
125981
  }
126003
125982
  var ScriptSnapshot, PackageJsonDependencyGroup, PackageJsonAutoImportPreference, LanguageServiceMode, emptyOptions, SemanticClassificationFormat, OrganizeImportsMode, CompletionTriggerKind, InlayHintKind, HighlightSpanKind, IndentStyle, SemicolonPreference, testFormatSettings, SymbolDisplayPartKind, CompletionInfoFlags, OutliningSpanKind, OutputFileType, EndOfLineState, TokenClass, ScriptElementKind, ScriptElementKindModifier, ClassificationTypeNames, ClassificationType;
@@ -127250,7 +127229,13 @@ ${lanes.join("\n")}
127250
127229
  sourceFile,
127251
127230
  n.kind
127252
127231
  );
127253
- return candidate2 && findRightmostToken(candidate2, sourceFile);
127232
+ if (candidate2) {
127233
+ if (!excludeJsdoc && isJSDocCommentContainingNode(candidate2) && candidate2.getChildren(sourceFile).length) {
127234
+ return find2(candidate2);
127235
+ }
127236
+ return findRightmostToken(candidate2, sourceFile);
127237
+ }
127238
+ return void 0;
127254
127239
  } else {
127255
127240
  return find2(child);
127256
127241
  }
@@ -155362,7 +155347,7 @@ ${lanes.join("\n")}
155362
155347
  false,
155363
155348
  failedAliasResolution
155364
155349
  )) : emptyArray;
155365
- return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || emptyArray);
155350
+ return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node));
155366
155351
  }
155367
155352
  if (isPropertyName(node) && isBindingElement(parent2) && isObjectBindingPattern(parent2.parent) && node === (parent2.propertyName || parent2.name)) {
155368
155353
  const name = getNameFromPropertyName(node);
@@ -155372,7 +155357,8 @@ ${lanes.join("\n")}
155372
155357
  return prop && getDefinitionFromSymbol(typeChecker, prop, node);
155373
155358
  });
155374
155359
  }
155375
- return concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
155360
+ const objectLiteralElementDefinition = getDefinitionFromObjectLiteralElement(typeChecker, node);
155361
+ return concatenate(fileReferenceDefinition, objectLiteralElementDefinition.length ? objectLiteralElementDefinition : getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
155376
155362
  }
155377
155363
  function symbolMatchesSignature(s, calledDeclaration) {
155378
155364
  var _a2;
@@ -155392,6 +155378,7 @@ ${lanes.join("\n")}
155392
155378
  ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
155393
155379
  }
155394
155380
  }
155381
+ return emptyArray;
155395
155382
  }
155396
155383
  function getDefinitionFromOverriddenMember(typeChecker, node) {
155397
155384
  const classElement = findAncestor(node, isClassElement);
@@ -168116,6 +168103,7 @@ ${options.prefix}` : "\n" : options.prefix
168116
168103
  }
168117
168104
  SmartIndenter2.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
168118
168105
  function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) {
168106
+ var _a2;
168119
168107
  const childKind = child ? child.kind : 0 /* Unknown */;
168120
168108
  switch (parent2.kind) {
168121
168109
  case 243 /* ExpressionStatement */:
@@ -168131,9 +168119,6 @@ ${options.prefix}` : "\n" : options.prefix
168131
168119
  case 186 /* TypeLiteral */:
168132
168120
  case 199 /* MappedType */:
168133
168121
  case 188 /* TupleType */:
168134
- case 268 /* CaseBlock */:
168135
- case 295 /* DefaultClause */:
168136
- case 294 /* CaseClause */:
168137
168122
  case 216 /* ParenthesizedExpression */:
168138
168123
  case 210 /* PropertyAccessExpression */:
168139
168124
  case 212 /* CallExpression */:
@@ -168162,7 +168147,11 @@ ${options.prefix}` : "\n" : options.prefix
168162
168147
  case 280 /* ExportSpecifier */:
168163
168148
  case 275 /* ImportSpecifier */:
168164
168149
  case 171 /* PropertyDeclaration */:
168150
+ case 294 /* CaseClause */:
168151
+ case 295 /* DefaultClause */:
168165
168152
  return true;
168153
+ case 268 /* CaseBlock */:
168154
+ return (_a2 = settings.indentSwitchCase) != null ? _a2 : true;
168166
168155
  case 259 /* VariableDeclaration */:
168167
168156
  case 301 /* PropertyAssignment */:
168168
168157
  case 225 /* BinaryExpression */:
@@ -169444,6 +169433,7 @@ ${options.prefix}` : "\n" : options.prefix
169444
169433
  getRootDeclaration: () => getRootDeclaration,
169445
169434
  getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
169446
169435
  getRootLength: () => getRootLength,
169436
+ getRootPathSplitLength: () => getRootPathSplitLength,
169447
169437
  getScriptKind: () => getScriptKind,
169448
169438
  getScriptKindFromFileName: () => getScriptKindFromFileName,
169449
169439
  getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -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.20230412`;
57
+ var version = `${versionMajorMinor}.0-dev.20230414`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -4851,11 +4851,11 @@ function getPathComponents(path2, currentDirectory = "") {
4851
4851
  path2 = combinePaths(currentDirectory, path2);
4852
4852
  return pathComponents(path2, getRootLength(path2));
4853
4853
  }
4854
- function getPathFromPathComponents(pathComponents2) {
4854
+ function getPathFromPathComponents(pathComponents2, length2) {
4855
4855
  if (pathComponents2.length === 0)
4856
4856
  return "";
4857
4857
  const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
4858
- return root + pathComponents2.slice(1).join(directorySeparator);
4858
+ return root + pathComponents2.slice(1, length2).join(directorySeparator);
4859
4859
  }
4860
4860
  function normalizeSlashes(path2) {
4861
4861
  return path2.indexOf("\\") !== -1 ? path2.replace(backslashRegExp, directorySeparator) : path2;
@@ -12942,7 +12942,7 @@ function createNodeFactory(flags, baseFactory2) {
12942
12942
  function createBigIntLiteral(value) {
12943
12943
  const node = createBaseToken(10 /* BigIntLiteral */);
12944
12944
  node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
12945
- node.transformFlags |= 4 /* ContainsESNext */;
12945
+ node.transformFlags |= 32 /* ContainsES2020 */;
12946
12946
  return node;
12947
12947
  }
12948
12948
  function createBaseStringLiteral(text, isSingleQuote) {
@@ -14452,7 +14452,7 @@ function createNodeFactory(flags, baseFactory2) {
14452
14452
  node.transformFlags |= 1024 /* ContainsES2015 */;
14453
14453
  break;
14454
14454
  case 102 /* ImportKeyword */:
14455
- node.transformFlags |= 4 /* ContainsESNext */;
14455
+ node.transformFlags |= 32 /* ContainsES2020 */;
14456
14456
  break;
14457
14457
  default:
14458
14458
  return Debug.assertNever(keywordToken);
@@ -14980,7 +14980,7 @@ function createNodeFactory(flags, baseFactory2) {
14980
14980
  function createNamespaceExport(name) {
14981
14981
  const node = createBaseDeclaration(279 /* NamespaceExport */);
14982
14982
  node.name = name;
14983
- node.transformFlags |= propagateChildFlags(node.name) | 4 /* ContainsESNext */;
14983
+ node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
14984
14984
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
14985
14985
  return node;
14986
14986
  }
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.20230412",
5
+ "version": "5.1.0-dev.20230414",
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": "14.21.1",
114
114
  "npm": "8.19.3"
115
115
  },
116
- "gitHead": "2db688e36ff57ee1d4f730e124ac340379eae4f0"
116
+ "gitHead": "3445e58815bae0c1c3752e9d364b56f548fa5634"
117
117
  }