typescript 5.4.0-dev.20231115 → 5.4.0-dev.20231117

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.
@@ -43,7 +43,7 @@ interface SuppressedError extends Error {
43
43
  suppressed: any;
44
44
  }
45
45
 
46
- interface SuppressedErrorConstructor extends ErrorConstructor {
46
+ interface SuppressedErrorConstructor {
47
47
  new (error: any, suppressed: any, message?: string): SuppressedError;
48
48
  (error: any, suppressed: any, message?: string): SuppressedError;
49
49
  readonly prototype: SuppressedError;
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.20231115`;
21
+ var version = `${versionMajorMinor}.0-dev.20231117`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -4521,6 +4521,7 @@ function createSystemWatchFunctions({
4521
4521
  useNonPollingWatchers,
4522
4522
  tscWatchDirectory,
4523
4523
  inodeWatching,
4524
+ fsWatchWithTimestamp,
4524
4525
  sysLog: sysLog2
4525
4526
  }) {
4526
4527
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -4759,7 +4760,7 @@ function createSystemWatchFunctions({
4759
4760
  return watchPresentFileSystemEntryWithFsWatchFile();
4760
4761
  }
4761
4762
  try {
4762
- const presentWatcher = fsWatchWorker(
4763
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4763
4764
  fileOrDirectory,
4764
4765
  recursive,
4765
4766
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -4822,6 +4823,18 @@ function createSystemWatchFunctions({
4822
4823
  );
4823
4824
  }
4824
4825
  }
4826
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
4827
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
4828
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
4829
+ if (eventName === "change") {
4830
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
4831
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
4832
+ return;
4833
+ }
4834
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
4835
+ callback(eventName, relativeFileName, modifiedTime);
4836
+ });
4837
+ }
4825
4838
  }
4826
4839
  function patchWriteFileEnsuringDirectory(sys2) {
4827
4840
  const originalWriteFile = sys2.writeFile;
@@ -4850,12 +4863,13 @@ var sys = (() => {
4850
4863
  let activeSession;
4851
4864
  let profilePath = "./profile.cpuprofile";
4852
4865
  const Buffer = require("buffer").Buffer;
4853
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4866
+ const isMacOs = process.platform === "darwin";
4867
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
4854
4868
  const platform = _os.platform();
4855
4869
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
4856
4870
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4857
4871
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4858
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4872
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
4859
4873
  const getCurrentDirectory = memoize(() => process.cwd());
4860
4874
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
4861
4875
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -4875,6 +4889,7 @@ var sys = (() => {
4875
4889
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4876
4890
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4877
4891
  inodeWatching: isLinuxOrMacOs,
4892
+ fsWatchWithTimestamp: isMacOs,
4878
4893
  sysLog
4879
4894
  });
4880
4895
  const nodeSystem = {
@@ -6667,6 +6682,7 @@ var Diagnostics = {
6667
6682
  Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
6668
6683
  A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
6669
6684
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
6685
+ Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6670
6686
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6671
6687
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6672
6688
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10961,7 +10977,7 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
10961
10977
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
10962
10978
  }
10963
10979
  function isCallLikeOrFunctionLikeExpression(node) {
10964
- return isCallLikeExpression(node) || isFunctionLike(node);
10980
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
10965
10981
  }
10966
10982
  function isCallLikeExpression(node) {
10967
10983
  switch (node.kind) {
@@ -18823,10 +18839,8 @@ function createNodeFactory(flags, baseFactory2) {
18823
18839
  return update(updated, original);
18824
18840
  }
18825
18841
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
18826
- const text = typeof value === "number" ? value + "" : value;
18827
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
18828
18842
  const node = createBaseDeclaration(9 /* NumericLiteral */);
18829
- node.text = text;
18843
+ node.text = typeof value === "number" ? value + "" : value;
18830
18844
  node.numericLiteralFlags = numericLiteralFlags;
18831
18845
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
18832
18846
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -43692,7 +43706,7 @@ function createTypeChecker(host) {
43692
43706
  const nodeLinks2 = getNodeLinks(node);
43693
43707
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
43694
43708
  nodeLinks2.resolvedSignature = void 0;
43695
- if (isFunctionLike(node)) {
43709
+ if (isFunctionExpressionOrArrowFunction(node)) {
43696
43710
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
43697
43711
  const type = symbolLinks2.type;
43698
43712
  cachedTypes2.push([symbolLinks2, type]);
@@ -48254,6 +48268,8 @@ function createTypeChecker(host) {
48254
48268
  context.symbolDepth.set(id, depth + 1);
48255
48269
  }
48256
48270
  context.visitedTypes.add(typeId);
48271
+ const prevTrackedSymbols = context.trackedSymbols;
48272
+ context.trackedSymbols = void 0;
48257
48273
  const startLength = context.approximateLength;
48258
48274
  const result = transform(type2);
48259
48275
  const addedLength = context.approximateLength - startLength;
@@ -48269,6 +48285,7 @@ function createTypeChecker(host) {
48269
48285
  if (id) {
48270
48286
  context.symbolDepth.set(id, depth);
48271
48287
  }
48288
+ context.trackedSymbols = prevTrackedSymbols;
48272
48289
  return result;
48273
48290
  function deepCloneOrReuseNode(node) {
48274
48291
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -48571,7 +48588,7 @@ function createTypeChecker(host) {
48571
48588
  context.approximateLength += symbolName(propertySymbol).length + 1;
48572
48589
  if (propertySymbol.flags & 98304 /* Accessor */) {
48573
48590
  const writeType = getWriteTypeOfSymbol(propertySymbol);
48574
- if (propertyType !== writeType) {
48591
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
48575
48592
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
48576
48593
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
48577
48594
  typeElements.push(
@@ -49520,7 +49537,7 @@ function createTypeChecker(host) {
49520
49537
  return factory.createStringLiteral(name, !!singleQuote);
49521
49538
  }
49522
49539
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
49523
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
49540
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
49524
49541
  }
49525
49542
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
49526
49543
  }
@@ -75403,14 +75420,9 @@ function createTypeChecker(host) {
75403
75420
  case 15 /* NoSubstitutionTemplateLiteral */:
75404
75421
  case 11 /* StringLiteral */:
75405
75422
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
75406
- case 9 /* NumericLiteral */: {
75423
+ case 9 /* NumericLiteral */:
75407
75424
  checkGrammarNumericLiteral(node);
75408
- const value = +node.text;
75409
- if (!isFinite(value)) {
75410
- return numberType;
75411
- }
75412
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
75413
- }
75425
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
75414
75426
  case 10 /* BigIntLiteral */:
75415
75427
  checkGrammarBigIntLiteral(node);
75416
75428
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -80315,6 +80327,16 @@ function createTypeChecker(host) {
80315
80327
  if (targetFlags & excludedMeanings) {
80316
80328
  const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
80317
80329
  error(node, message, symbolToString(symbol));
80330
+ } else if (node.kind !== 281 /* ExportSpecifier */) {
80331
+ const appearsValueyToTranspiler = compilerOptions.isolatedModules && !findAncestor(node, isTypeOnlyImportOrExportDeclaration);
80332
+ if (appearsValueyToTranspiler && symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */)) {
80333
+ error(
80334
+ node,
80335
+ Diagnostics.Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled,
80336
+ symbolToString(symbol),
80337
+ isolatedModulesLikeFlagName
80338
+ );
80339
+ }
80318
80340
  }
80319
80341
  if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
80320
80342
  const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
@@ -82411,7 +82433,7 @@ function createTypeChecker(host) {
82411
82433
  if (enumResult)
82412
82434
  return enumResult;
82413
82435
  const literalValue = type.value;
82414
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
82436
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
82415
82437
  }
82416
82438
  function createLiteralConstValue(node, tracker) {
82417
82439
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -88840,7 +88862,7 @@ function transformTypeScript(context) {
88840
88862
  function transformEnumMemberDeclarationValue(member) {
88841
88863
  const value = resolver.getConstantValue(member);
88842
88864
  if (value !== void 0) {
88843
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
88865
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
88844
88866
  } else {
88845
88867
  enableSubstitutionForNonQualifiedEnumMembers();
88846
88868
  if (member.initializer) {
@@ -103160,7 +103182,7 @@ function transformGenerators(context) {
103160
103182
  if (labelExpressions === void 0) {
103161
103183
  labelExpressions = [];
103162
103184
  }
103163
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
103185
+ const expression = factory2.createNumericLiteral(-1);
103164
103186
  if (labelExpressions[label] === void 0) {
103165
103187
  labelExpressions[label] = [expression];
103166
103188
  } else {
@@ -109035,8 +109057,7 @@ function transformDeclarations(context) {
109035
109057
  if (shouldStripInternal(m))
109036
109058
  return;
109037
109059
  const constValue = resolver.getConstantValue(m);
109038
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
109039
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
109060
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
109040
109061
  }))
109041
109062
  ));
109042
109063
  }
package/lib/tsserver.js CHANGED
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
2330
2330
 
2331
2331
  // src/compiler/corePublic.ts
2332
2332
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-dev.20231115`;
2333
+ var version = `${versionMajorMinor}.0-dev.20231117`;
2334
2334
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2335
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2336
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8041,6 +8041,7 @@ function createSystemWatchFunctions({
8041
8041
  useNonPollingWatchers,
8042
8042
  tscWatchDirectory,
8043
8043
  inodeWatching,
8044
+ fsWatchWithTimestamp,
8044
8045
  sysLog: sysLog2
8045
8046
  }) {
8046
8047
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -8279,7 +8280,7 @@ function createSystemWatchFunctions({
8279
8280
  return watchPresentFileSystemEntryWithFsWatchFile();
8280
8281
  }
8281
8282
  try {
8282
- const presentWatcher = fsWatchWorker(
8283
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
8283
8284
  fileOrDirectory,
8284
8285
  recursive,
8285
8286
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -8342,6 +8343,18 @@ function createSystemWatchFunctions({
8342
8343
  );
8343
8344
  }
8344
8345
  }
8346
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
8347
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
8348
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
8349
+ if (eventName === "change") {
8350
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
8351
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
8352
+ return;
8353
+ }
8354
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
8355
+ callback(eventName, relativeFileName, modifiedTime);
8356
+ });
8357
+ }
8345
8358
  }
8346
8359
  function patchWriteFileEnsuringDirectory(sys2) {
8347
8360
  const originalWriteFile = sys2.writeFile;
@@ -8370,12 +8383,13 @@ var sys = (() => {
8370
8383
  let activeSession;
8371
8384
  let profilePath = "./profile.cpuprofile";
8372
8385
  const Buffer2 = require("buffer").Buffer;
8373
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
8386
+ const isMacOs = process.platform === "darwin";
8387
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
8374
8388
  const platform = _os.platform();
8375
8389
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
8376
8390
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
8377
8391
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
8378
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
8392
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
8379
8393
  const getCurrentDirectory = memoize(() => process.cwd());
8380
8394
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
8381
8395
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -8395,6 +8409,7 @@ var sys = (() => {
8395
8409
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
8396
8410
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
8397
8411
  inodeWatching: isLinuxOrMacOs,
8412
+ fsWatchWithTimestamp: isMacOs,
8398
8413
  sysLog
8399
8414
  });
8400
8415
  const nodeSystem = {
@@ -10199,6 +10214,7 @@ var Diagnostics = {
10199
10214
  Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
10200
10215
  A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
10201
10216
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
10217
+ Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
10202
10218
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10203
10219
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10204
10220
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -14643,7 +14659,7 @@ function isPropertyAccessOrQualifiedName(node) {
14643
14659
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
14644
14660
  }
14645
14661
  function isCallLikeOrFunctionLikeExpression(node) {
14646
- return isCallLikeExpression(node) || isFunctionLike(node);
14662
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
14647
14663
  }
14648
14664
  function isCallLikeExpression(node) {
14649
14665
  switch (node.kind) {
@@ -23035,10 +23051,8 @@ function createNodeFactory(flags, baseFactory2) {
23035
23051
  return update(updated, original);
23036
23052
  }
23037
23053
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
23038
- const text = typeof value === "number" ? value + "" : value;
23039
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
23040
23054
  const node = createBaseDeclaration(9 /* NumericLiteral */);
23041
- node.text = text;
23055
+ node.text = typeof value === "number" ? value + "" : value;
23042
23056
  node.numericLiteralFlags = numericLiteralFlags;
23043
23057
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
23044
23058
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -48400,7 +48414,7 @@ function createTypeChecker(host) {
48400
48414
  const nodeLinks2 = getNodeLinks(node);
48401
48415
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
48402
48416
  nodeLinks2.resolvedSignature = void 0;
48403
- if (isFunctionLike(node)) {
48417
+ if (isFunctionExpressionOrArrowFunction(node)) {
48404
48418
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
48405
48419
  const type = symbolLinks2.type;
48406
48420
  cachedTypes2.push([symbolLinks2, type]);
@@ -52962,6 +52976,8 @@ function createTypeChecker(host) {
52962
52976
  context.symbolDepth.set(id, depth + 1);
52963
52977
  }
52964
52978
  context.visitedTypes.add(typeId);
52979
+ const prevTrackedSymbols = context.trackedSymbols;
52980
+ context.trackedSymbols = void 0;
52965
52981
  const startLength = context.approximateLength;
52966
52982
  const result = transform2(type2);
52967
52983
  const addedLength = context.approximateLength - startLength;
@@ -52977,6 +52993,7 @@ function createTypeChecker(host) {
52977
52993
  if (id) {
52978
52994
  context.symbolDepth.set(id, depth);
52979
52995
  }
52996
+ context.trackedSymbols = prevTrackedSymbols;
52980
52997
  return result;
52981
52998
  function deepCloneOrReuseNode(node) {
52982
52999
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -53279,7 +53296,7 @@ function createTypeChecker(host) {
53279
53296
  context.approximateLength += symbolName(propertySymbol).length + 1;
53280
53297
  if (propertySymbol.flags & 98304 /* Accessor */) {
53281
53298
  const writeType = getWriteTypeOfSymbol(propertySymbol);
53282
- if (propertyType !== writeType) {
53299
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
53283
53300
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
53284
53301
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
53285
53302
  typeElements.push(
@@ -54228,7 +54245,7 @@ function createTypeChecker(host) {
54228
54245
  return factory.createStringLiteral(name, !!singleQuote);
54229
54246
  }
54230
54247
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
54231
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
54248
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
54232
54249
  }
54233
54250
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
54234
54251
  }
@@ -80111,14 +80128,9 @@ function createTypeChecker(host) {
80111
80128
  case 15 /* NoSubstitutionTemplateLiteral */:
80112
80129
  case 11 /* StringLiteral */:
80113
80130
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
80114
- case 9 /* NumericLiteral */: {
80131
+ case 9 /* NumericLiteral */:
80115
80132
  checkGrammarNumericLiteral(node);
80116
- const value = +node.text;
80117
- if (!isFinite(value)) {
80118
- return numberType;
80119
- }
80120
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
80121
- }
80133
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
80122
80134
  case 10 /* BigIntLiteral */:
80123
80135
  checkGrammarBigIntLiteral(node);
80124
80136
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -85023,6 +85035,16 @@ function createTypeChecker(host) {
85023
85035
  if (targetFlags & excludedMeanings) {
85024
85036
  const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
85025
85037
  error2(node, message, symbolToString(symbol));
85038
+ } else if (node.kind !== 281 /* ExportSpecifier */) {
85039
+ const appearsValueyToTranspiler = compilerOptions.isolatedModules && !findAncestor(node, isTypeOnlyImportOrExportDeclaration);
85040
+ if (appearsValueyToTranspiler && symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */)) {
85041
+ error2(
85042
+ node,
85043
+ Diagnostics.Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled,
85044
+ symbolToString(symbol),
85045
+ isolatedModulesLikeFlagName
85046
+ );
85047
+ }
85026
85048
  }
85027
85049
  if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
85028
85050
  const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
@@ -87119,7 +87141,7 @@ function createTypeChecker(host) {
87119
87141
  if (enumResult)
87120
87142
  return enumResult;
87121
87143
  const literalValue = type.value;
87122
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
87144
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
87123
87145
  }
87124
87146
  function createLiteralConstValue(node, tracker) {
87125
87147
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -93719,7 +93741,7 @@ function transformTypeScript(context) {
93719
93741
  function transformEnumMemberDeclarationValue(member) {
93720
93742
  const value = resolver.getConstantValue(member);
93721
93743
  if (value !== void 0) {
93722
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
93744
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
93723
93745
  } else {
93724
93746
  enableSubstitutionForNonQualifiedEnumMembers();
93725
93747
  if (member.initializer) {
@@ -108039,7 +108061,7 @@ function transformGenerators(context) {
108039
108061
  if (labelExpressions === void 0) {
108040
108062
  labelExpressions = [];
108041
108063
  }
108042
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
108064
+ const expression = factory2.createNumericLiteral(-1);
108043
108065
  if (labelExpressions[label] === void 0) {
108044
108066
  labelExpressions[label] = [expression];
108045
108067
  } else {
@@ -113914,8 +113936,7 @@ function transformDeclarations(context) {
113914
113936
  if (shouldStripInternal(m))
113915
113937
  return;
113916
113938
  const constValue = resolver.getConstantValue(m);
113917
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
113918
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
113939
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
113919
113940
  }))
113920
113941
  ));
113921
113942
  }
@@ -135736,6 +135757,7 @@ var DocumentHighlights;
135736
135757
  case 127 /* YieldKeyword */:
135737
135758
  return highlightSpans(getYieldOccurrences(node));
135738
135759
  case 103 /* InKeyword */:
135760
+ case 147 /* OutKeyword */:
135739
135761
  return void 0;
135740
135762
  default:
135741
135763
  return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0;
@@ -158902,6 +158924,9 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
158902
158924
  if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 /* Global */ && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
158903
158925
  continue;
158904
158926
  }
158927
+ if (!isTypeOnlyLocation && isInJSFile(sourceFile) && symbolAppearsToBeTypeOnly(symbol)) {
158928
+ continue;
158929
+ }
158905
158930
  const { name, needsConvertPropertyAccess } = info;
158906
158931
  const originalSortText = (symbolToSortTextMap == null ? void 0 : symbolToSortTextMap[getSymbolId(symbol)]) ?? SortText.LocationPriority;
158907
158932
  const sortText = isDeprecated(symbol, typeChecker) ? SortText.Deprecated(originalSortText) : originalSortText;
@@ -158981,6 +159006,10 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
158981
159006
  }
158982
159007
  return !!(allFlags & 111551 /* Value */);
158983
159008
  }
159009
+ function symbolAppearsToBeTypeOnly(symbol) {
159010
+ var _a;
159011
+ return !(symbol.flags & 111551 /* Value */) && (!isInJSFile((_a = symbol.declarations) == null ? void 0 : _a[0]) || !!(symbol.flags & 788968 /* Type */));
159012
+ }
158984
159013
  }
158985
159014
  function getLabelCompletionAtPosition(node) {
158986
159015
  const entries = getLabelStatementCompletions(node);
@@ -175460,7 +175489,7 @@ var TypingsInstaller = class {
175460
175489
  }
175461
175490
  /** @internal */
175462
175491
  installPackage(req) {
175463
- const { fileName, packageName, projectName, projectRootPath } = req;
175492
+ const { fileName, packageName, projectName, projectRootPath, id } = req;
175464
175493
  const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
175465
175494
  if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
175466
175495
  return directory;
@@ -175472,6 +175501,7 @@ var TypingsInstaller = class {
175472
175501
  const response = {
175473
175502
  kind: ActionPackageInstalled,
175474
175503
  projectName,
175504
+ id,
175475
175505
  success,
175476
175506
  message
175477
175507
  };
@@ -175481,6 +175511,7 @@ var TypingsInstaller = class {
175481
175511
  const response = {
175482
175512
  kind: ActionPackageInstalled,
175483
175513
  projectName,
175514
+ id,
175484
175515
  success: false,
175485
175516
  message: "Could not determine a project root path."
175486
175517
  };
@@ -186676,6 +186707,7 @@ var _TypingsInstallerAdapter = class _TypingsInstallerAdapter {
186676
186707
  // Maps project name to newest requestQueue entry for that project
186677
186708
  /** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
186678
186709
  this.requestedRegistry = false;
186710
+ this.packageInstallId = 0;
186679
186711
  }
186680
186712
  isKnownTypesPackageName(name) {
186681
186713
  var _a;
@@ -186690,11 +186722,13 @@ var _TypingsInstallerAdapter = class _TypingsInstallerAdapter {
186690
186722
  return !!((_a = this.typesRegistryCache) == null ? void 0 : _a.has(name));
186691
186723
  }
186692
186724
  installPackage(options) {
186693
- this.installer.send({ kind: "installPackage", ...options });
186694
- Debug.assert(this.packageInstalledPromise === void 0);
186695
- return new Promise((resolve, reject) => {
186696
- this.packageInstalledPromise = { resolve, reject };
186725
+ this.packageInstallId++;
186726
+ const request = { kind: "installPackage", ...options, id: this.packageInstallId };
186727
+ const promise = new Promise((resolve, reject) => {
186728
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve, reject });
186697
186729
  });
186730
+ this.installer.send(request);
186731
+ return promise;
186698
186732
  }
186699
186733
  attach(projectService) {
186700
186734
  this.projectService = projectService;
@@ -186719,6 +186753,7 @@ var _TypingsInstallerAdapter = class _TypingsInstallerAdapter {
186719
186753
  }
186720
186754
  }
186721
186755
  handleMessage(response) {
186756
+ var _a, _b;
186722
186757
  if (this.logger.hasLevel(3 /* verbose */)) {
186723
186758
  this.logger.info(`TIAdapter:: Received response:${stringifyIndented(response)}`);
186724
186759
  }
@@ -186727,13 +186762,14 @@ var _TypingsInstallerAdapter = class _TypingsInstallerAdapter {
186727
186762
  this.typesRegistryCache = new Map(Object.entries(response.typesRegistry));
186728
186763
  break;
186729
186764
  case ActionPackageInstalled: {
186730
- const { success, message } = response;
186731
- if (success) {
186732
- this.packageInstalledPromise.resolve({ successMessage: message });
186765
+ const promise = (_a = this.packageInstalledPromise) == null ? void 0 : _a.get(response.id);
186766
+ Debug.assertIsDefined(promise, "Should find the promise for package install");
186767
+ (_b = this.packageInstalledPromise) == null ? void 0 : _b.delete(response.id);
186768
+ if (response.success) {
186769
+ promise.resolve({ successMessage: response.message });
186733
186770
  } else {
186734
- this.packageInstalledPromise.reject(message);
186771
+ promise.reject(response.message);
186735
186772
  }
186736
- this.packageInstalledPromise = void 0;
186737
186773
  this.projectService.updateTypingsForProject(response);
186738
186774
  this.event(response, "setTypings");
186739
186775
  break;
@@ -49,9 +49,11 @@ declare namespace ts {
49
49
  readonly fileName: Path;
50
50
  readonly packageName: string;
51
51
  readonly projectRootPath: Path;
52
+ readonly id: number;
52
53
  }
53
54
  interface PackageInstalledResponse extends ProjectResponse {
54
55
  readonly kind: ActionPackageInstalled;
56
+ readonly id: number;
55
57
  readonly success: boolean;
56
58
  readonly message: string;
57
59
  }
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.20231115`;
38
+ version = `${versionMajorMinor}.0-dev.20231117`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5779,6 +5779,7 @@ ${lanes.join("\n")}
5779
5779
  useNonPollingWatchers,
5780
5780
  tscWatchDirectory,
5781
5781
  inodeWatching,
5782
+ fsWatchWithTimestamp,
5782
5783
  sysLog: sysLog2
5783
5784
  }) {
5784
5785
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -6017,7 +6018,7 @@ ${lanes.join("\n")}
6017
6018
  return watchPresentFileSystemEntryWithFsWatchFile();
6018
6019
  }
6019
6020
  try {
6020
- const presentWatcher = fsWatchWorker(
6021
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
6021
6022
  fileOrDirectory,
6022
6023
  recursive,
6023
6024
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -6080,6 +6081,18 @@ ${lanes.join("\n")}
6080
6081
  );
6081
6082
  }
6082
6083
  }
6084
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
6085
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
6086
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
6087
+ if (eventName === "change") {
6088
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
6089
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
6090
+ return;
6091
+ }
6092
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
6093
+ callback(eventName, relativeFileName, modifiedTime);
6094
+ });
6095
+ }
6083
6096
  }
6084
6097
  function patchWriteFileEnsuringDirectory(sys2) {
6085
6098
  const originalWriteFile = sys2.writeFile;
@@ -6139,12 +6152,13 @@ ${lanes.join("\n")}
6139
6152
  let activeSession;
6140
6153
  let profilePath = "./profile.cpuprofile";
6141
6154
  const Buffer2 = require("buffer").Buffer;
6142
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6155
+ const isMacOs = process.platform === "darwin";
6156
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
6143
6157
  const platform = _os.platform();
6144
6158
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
6145
6159
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6146
6160
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6147
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6161
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
6148
6162
  const getCurrentDirectory = memoize(() => process.cwd());
6149
6163
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6150
6164
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -6164,6 +6178,7 @@ ${lanes.join("\n")}
6164
6178
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
6165
6179
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6166
6180
  inodeWatching: isLinuxOrMacOs,
6181
+ fsWatchWithTimestamp: isMacOs,
6167
6182
  sysLog
6168
6183
  });
6169
6184
  const nodeSystem = {
@@ -7979,6 +7994,7 @@ ${lanes.join("\n")}
7979
7994
  Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
7980
7995
  A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
7981
7996
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
7997
+ Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
7982
7998
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
7983
7999
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
7984
8000
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -12430,7 +12446,7 @@ ${lanes.join("\n")}
12430
12446
  return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
12431
12447
  }
12432
12448
  function isCallLikeOrFunctionLikeExpression(node) {
12433
- return isCallLikeExpression(node) || isFunctionLike(node);
12449
+ return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
12434
12450
  }
12435
12451
  function isCallLikeExpression(node) {
12436
12452
  switch (node.kind) {
@@ -20847,10 +20863,8 @@ ${lanes.join("\n")}
20847
20863
  return update(updated, original);
20848
20864
  }
20849
20865
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
20850
- const text = typeof value === "number" ? value + "" : value;
20851
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
20852
20866
  const node = createBaseDeclaration(9 /* NumericLiteral */);
20853
- node.text = text;
20867
+ node.text = typeof value === "number" ? value + "" : value;
20854
20868
  node.numericLiteralFlags = numericLiteralFlags;
20855
20869
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
20856
20870
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -46165,7 +46179,7 @@ ${lanes.join("\n")}
46165
46179
  const nodeLinks2 = getNodeLinks(node);
46166
46180
  cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
46167
46181
  nodeLinks2.resolvedSignature = void 0;
46168
- if (isFunctionLike(node)) {
46182
+ if (isFunctionExpressionOrArrowFunction(node)) {
46169
46183
  const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
46170
46184
  const type = symbolLinks2.type;
46171
46185
  cachedTypes2.push([symbolLinks2, type]);
@@ -50727,6 +50741,8 @@ ${lanes.join("\n")}
50727
50741
  context.symbolDepth.set(id, depth + 1);
50728
50742
  }
50729
50743
  context.visitedTypes.add(typeId);
50744
+ const prevTrackedSymbols = context.trackedSymbols;
50745
+ context.trackedSymbols = void 0;
50730
50746
  const startLength = context.approximateLength;
50731
50747
  const result = transform2(type2);
50732
50748
  const addedLength = context.approximateLength - startLength;
@@ -50742,6 +50758,7 @@ ${lanes.join("\n")}
50742
50758
  if (id) {
50743
50759
  context.symbolDepth.set(id, depth);
50744
50760
  }
50761
+ context.trackedSymbols = prevTrackedSymbols;
50745
50762
  return result;
50746
50763
  function deepCloneOrReuseNode(node) {
50747
50764
  if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
@@ -51044,7 +51061,7 @@ ${lanes.join("\n")}
51044
51061
  context.approximateLength += symbolName(propertySymbol).length + 1;
51045
51062
  if (propertySymbol.flags & 98304 /* Accessor */) {
51046
51063
  const writeType = getWriteTypeOfSymbol(propertySymbol);
51047
- if (propertyType !== writeType) {
51064
+ if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
51048
51065
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
51049
51066
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
51050
51067
  typeElements.push(
@@ -51993,7 +52010,7 @@ ${lanes.join("\n")}
51993
52010
  return factory.createStringLiteral(name, !!singleQuote);
51994
52011
  }
51995
52012
  if (isNumericLiteralName(name) && startsWith(name, "-")) {
51996
- return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name))));
52013
+ return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
51997
52014
  }
51998
52015
  return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
51999
52016
  }
@@ -77876,14 +77893,9 @@ ${lanes.join("\n")}
77876
77893
  case 15 /* NoSubstitutionTemplateLiteral */:
77877
77894
  case 11 /* StringLiteral */:
77878
77895
  return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text));
77879
- case 9 /* NumericLiteral */: {
77896
+ case 9 /* NumericLiteral */:
77880
77897
  checkGrammarNumericLiteral(node);
77881
- const value = +node.text;
77882
- if (!isFinite(value)) {
77883
- return numberType;
77884
- }
77885
- return getFreshTypeOfLiteralType(getNumberLiteralType(value));
77886
- }
77898
+ return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text));
77887
77899
  case 10 /* BigIntLiteral */:
77888
77900
  checkGrammarBigIntLiteral(node);
77889
77901
  return getFreshTypeOfLiteralType(getBigIntLiteralType({
@@ -82788,6 +82800,16 @@ ${lanes.join("\n")}
82788
82800
  if (targetFlags & excludedMeanings) {
82789
82801
  const message = node.kind === 281 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
82790
82802
  error2(node, message, symbolToString(symbol));
82803
+ } else if (node.kind !== 281 /* ExportSpecifier */) {
82804
+ const appearsValueyToTranspiler = compilerOptions.isolatedModules && !findAncestor(node, isTypeOnlyImportOrExportDeclaration);
82805
+ if (appearsValueyToTranspiler && symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */)) {
82806
+ error2(
82807
+ node,
82808
+ Diagnostics.Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled,
82809
+ symbolToString(symbol),
82810
+ isolatedModulesLikeFlagName
82811
+ );
82812
+ }
82791
82813
  }
82792
82814
  if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
82793
82815
  const typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol);
@@ -84884,7 +84906,7 @@ ${lanes.join("\n")}
84884
84906
  if (enumResult)
84885
84907
  return enumResult;
84886
84908
  const literalValue = type.value;
84887
- return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue);
84909
+ return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue);
84888
84910
  }
84889
84911
  function createLiteralConstValue(node, tracker) {
84890
84912
  const type = getTypeOfSymbol(getSymbolOfDeclaration(node));
@@ -91664,7 +91686,7 @@ ${lanes.join("\n")}
91664
91686
  function transformEnumMemberDeclarationValue(member) {
91665
91687
  const value = resolver.getConstantValue(member);
91666
91688
  if (value !== void 0) {
91667
- return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value);
91689
+ return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value);
91668
91690
  } else {
91669
91691
  enableSubstitutionForNonQualifiedEnumMembers();
91670
91692
  if (member.initializer) {
@@ -106077,7 +106099,7 @@ ${lanes.join("\n")}
106077
106099
  if (labelExpressions === void 0) {
106078
106100
  labelExpressions = [];
106079
106101
  }
106080
- const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER);
106102
+ const expression = factory2.createNumericLiteral(-1);
106081
106103
  if (labelExpressions[label] === void 0) {
106082
106104
  labelExpressions[label] = [expression];
106083
106105
  } else {
@@ -111988,8 +112010,7 @@ ${lanes.join("\n")}
111988
112010
  if (shouldStripInternal(m))
111989
112011
  return;
111990
112012
  const constValue = resolver.getConstantValue(m);
111991
- const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue);
111992
- return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m);
112013
+ return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m);
111993
112014
  }))
111994
112015
  ));
111995
112016
  }
@@ -134067,6 +134088,7 @@ ${lanes.join("\n")}
134067
134088
  case 127 /* YieldKeyword */:
134068
134089
  return highlightSpans(getYieldOccurrences(node));
134069
134090
  case 103 /* InKeyword */:
134091
+ case 147 /* OutKeyword */:
134070
134092
  return void 0;
134071
134093
  default:
134072
134094
  return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0;
@@ -158125,6 +158147,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158125
158147
  if (!info || uniques.get(info.name) && (!origin || !originIsObjectLiteralMethod(origin)) || kind === 1 /* Global */ && symbolToSortTextMap && !shouldIncludeSymbol(symbol, symbolToSortTextMap)) {
158126
158148
  continue;
158127
158149
  }
158150
+ if (!isTypeOnlyLocation && isInJSFile(sourceFile) && symbolAppearsToBeTypeOnly(symbol)) {
158151
+ continue;
158152
+ }
158128
158153
  const { name, needsConvertPropertyAccess } = info;
158129
158154
  const originalSortText = (symbolToSortTextMap == null ? void 0 : symbolToSortTextMap[getSymbolId(symbol)]) ?? SortText.LocationPriority;
158130
158155
  const sortText = isDeprecated(symbol, typeChecker) ? SortText.Deprecated(originalSortText) : originalSortText;
@@ -158204,6 +158229,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158204
158229
  }
158205
158230
  return !!(allFlags & 111551 /* Value */);
158206
158231
  }
158232
+ function symbolAppearsToBeTypeOnly(symbol) {
158233
+ var _a;
158234
+ return !(symbol.flags & 111551 /* Value */) && (!isInJSFile((_a = symbol.declarations) == null ? void 0 : _a[0]) || !!(symbol.flags & 788968 /* Type */));
158235
+ }
158207
158236
  }
158208
158237
  function getLabelCompletionAtPosition(node) {
158209
158238
  const entries = getLabelStatementCompletions(node);
@@ -172674,7 +172703,7 @@ ${options.prefix}` : "\n" : options.prefix
172674
172703
  }
172675
172704
  /** @internal */
172676
172705
  installPackage(req) {
172677
- const { fileName, packageName, projectName, projectRootPath } = req;
172706
+ const { fileName, packageName, projectName, projectRootPath, id } = req;
172678
172707
  const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
172679
172708
  if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
172680
172709
  return directory;
@@ -172686,6 +172715,7 @@ ${options.prefix}` : "\n" : options.prefix
172686
172715
  const response = {
172687
172716
  kind: ActionPackageInstalled,
172688
172717
  projectName,
172718
+ id,
172689
172719
  success,
172690
172720
  message
172691
172721
  };
@@ -172695,6 +172725,7 @@ ${options.prefix}` : "\n" : options.prefix
172695
172725
  const response = {
172696
172726
  kind: ActionPackageInstalled,
172697
172727
  projectName,
172728
+ id,
172698
172729
  success: false,
172699
172730
  message: "Could not determine a project root path."
172700
172731
  };
@@ -184015,6 +184046,7 @@ ${e.message}`;
184015
184046
  // Maps project name to newest requestQueue entry for that project
184016
184047
  /** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
184017
184048
  this.requestedRegistry = false;
184049
+ this.packageInstallId = 0;
184018
184050
  }
184019
184051
  isKnownTypesPackageName(name) {
184020
184052
  var _a;
@@ -184029,11 +184061,13 @@ ${e.message}`;
184029
184061
  return !!((_a = this.typesRegistryCache) == null ? void 0 : _a.has(name));
184030
184062
  }
184031
184063
  installPackage(options) {
184032
- this.installer.send({ kind: "installPackage", ...options });
184033
- Debug.assert(this.packageInstalledPromise === void 0);
184034
- return new Promise((resolve, reject) => {
184035
- this.packageInstalledPromise = { resolve, reject };
184064
+ this.packageInstallId++;
184065
+ const request = { kind: "installPackage", ...options, id: this.packageInstallId };
184066
+ const promise = new Promise((resolve, reject) => {
184067
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve, reject });
184036
184068
  });
184069
+ this.installer.send(request);
184070
+ return promise;
184037
184071
  }
184038
184072
  attach(projectService) {
184039
184073
  this.projectService = projectService;
@@ -184058,6 +184092,7 @@ ${e.message}`;
184058
184092
  }
184059
184093
  }
184060
184094
  handleMessage(response) {
184095
+ var _a, _b;
184061
184096
  if (this.logger.hasLevel(3 /* verbose */)) {
184062
184097
  this.logger.info(`TIAdapter:: Received response:${stringifyIndented(response)}`);
184063
184098
  }
@@ -184066,13 +184101,14 @@ ${e.message}`;
184066
184101
  this.typesRegistryCache = new Map(Object.entries(response.typesRegistry));
184067
184102
  break;
184068
184103
  case ActionPackageInstalled: {
184069
- const { success, message } = response;
184070
- if (success) {
184071
- this.packageInstalledPromise.resolve({ successMessage: message });
184104
+ const promise = (_a = this.packageInstalledPromise) == null ? void 0 : _a.get(response.id);
184105
+ Debug.assertIsDefined(promise, "Should find the promise for package install");
184106
+ (_b = this.packageInstalledPromise) == null ? void 0 : _b.delete(response.id);
184107
+ if (response.success) {
184108
+ promise.resolve({ successMessage: response.message });
184072
184109
  } else {
184073
- this.packageInstalledPromise.reject(message);
184110
+ promise.reject(response.message);
184074
184111
  }
184075
- this.packageInstalledPromise = void 0;
184076
184112
  this.projectService.updateTypingsForProject(response);
184077
184113
  this.event(response, "setTypings");
184078
184114
  break;
@@ -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.20231115`;
57
+ var version = `${versionMajorMinor}.0-dev.20231117`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -3934,6 +3934,7 @@ function createSystemWatchFunctions({
3934
3934
  useNonPollingWatchers,
3935
3935
  tscWatchDirectory,
3936
3936
  inodeWatching,
3937
+ fsWatchWithTimestamp,
3937
3938
  sysLog: sysLog2
3938
3939
  }) {
3939
3940
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -4172,7 +4173,7 @@ function createSystemWatchFunctions({
4172
4173
  return watchPresentFileSystemEntryWithFsWatchFile();
4173
4174
  }
4174
4175
  try {
4175
- const presentWatcher = fsWatchWorker(
4176
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4176
4177
  fileOrDirectory,
4177
4178
  recursive,
4178
4179
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -4235,6 +4236,18 @@ function createSystemWatchFunctions({
4235
4236
  );
4236
4237
  }
4237
4238
  }
4239
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
4240
+ let modifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
4241
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
4242
+ if (eventName === "change") {
4243
+ currentModifiedTime || (currentModifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime);
4244
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
4245
+ return;
4246
+ }
4247
+ modifiedTime = currentModifiedTime || getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
4248
+ callback(eventName, relativeFileName, modifiedTime);
4249
+ });
4250
+ }
4238
4251
  }
4239
4252
  function patchWriteFileEnsuringDirectory(sys2) {
4240
4253
  const originalWriteFile = sys2.writeFile;
@@ -4263,12 +4276,13 @@ var sys = (() => {
4263
4276
  let activeSession;
4264
4277
  let profilePath = "./profile.cpuprofile";
4265
4278
  const Buffer2 = require("buffer").Buffer;
4266
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4279
+ const isMacOs = process.platform === "darwin";
4280
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
4267
4281
  const platform = _os.platform();
4268
4282
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
4269
4283
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4270
4284
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4271
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4285
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
4272
4286
  const getCurrentDirectory = memoize(() => process.cwd());
4273
4287
  const { watchFile, watchDirectory } = createSystemWatchFunctions({
4274
4288
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -4288,6 +4302,7 @@ var sys = (() => {
4288
4302
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4289
4303
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4290
4304
  inodeWatching: isLinuxOrMacOs,
4305
+ fsWatchWithTimestamp: isMacOs,
4291
4306
  sysLog
4292
4307
  });
4293
4308
  const nodeSystem = {
@@ -6044,6 +6059,7 @@ var Diagnostics = {
6044
6059
  Type_0_is_generic_and_can_only_be_indexed_for_reading: diag(2862, 1 /* Error */, "Type_0_is_generic_and_can_only_be_indexed_for_reading_2862", "Type '{0}' is generic and can only be indexed for reading."),
6045
6060
  A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values: diag(2863, 1 /* Error */, "A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values_2863", "A class cannot extend a primitive type like '{0}'. Classes can only extend constructable values."),
6046
6061
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
6062
+ Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6047
6063
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6048
6064
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6049
6065
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -13041,10 +13057,8 @@ function createNodeFactory(flags, baseFactory2) {
13041
13057
  return update(updated, original);
13042
13058
  }
13043
13059
  function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) {
13044
- const text = typeof value === "number" ? value + "" : value;
13045
- Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression");
13046
13060
  const node = createBaseDeclaration(9 /* NumericLiteral */);
13047
- node.text = text;
13061
+ node.text = typeof value === "number" ? value + "" : value;
13048
13062
  node.numericLiteralFlags = numericLiteralFlags;
13049
13063
  if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */)
13050
13064
  node.transformFlags |= 1024 /* ContainsES2015 */;
@@ -31933,7 +31947,7 @@ var TypingsInstaller = class {
31933
31947
  }
31934
31948
  /** @internal */
31935
31949
  installPackage(req) {
31936
- const { fileName, packageName, projectName, projectRootPath } = req;
31950
+ const { fileName, packageName, projectName, projectRootPath, id } = req;
31937
31951
  const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => {
31938
31952
  if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) {
31939
31953
  return directory;
@@ -31945,6 +31959,7 @@ var TypingsInstaller = class {
31945
31959
  const response = {
31946
31960
  kind: ActionPackageInstalled,
31947
31961
  projectName,
31962
+ id,
31948
31963
  success,
31949
31964
  message
31950
31965
  };
@@ -31954,6 +31969,7 @@ var TypingsInstaller = class {
31954
31969
  const response = {
31955
31970
  kind: ActionPackageInstalled,
31956
31971
  projectName,
31972
+ id,
31957
31973
  success: false,
31958
31974
  message: "Could not determine a project root path."
31959
31975
  };
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.20231115",
5
+ "version": "5.4.0-dev.20231117",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "e170bc59d4ba0d335ce86f66296bec71c5018317"
117
+ "gitHead": "196dcf8a95de386886aea5aafc34c7b4d07aeecb"
118
118
  }