typescript 5.1.0-dev.20230308 → 5.1.0-dev.20230310

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.
@@ -20,6 +20,27 @@ and limitations under the License.
20
20
  /// Worker Iterable APIs
21
21
  /////////////////////////////
22
22
 
23
+ interface CSSNumericArray {
24
+ [Symbol.iterator](): IterableIterator<CSSNumericValue>;
25
+ entries(): IterableIterator<[number, CSSNumericValue]>;
26
+ keys(): IterableIterator<number>;
27
+ values(): IterableIterator<CSSNumericValue>;
28
+ }
29
+
30
+ interface CSSTransformValue {
31
+ [Symbol.iterator](): IterableIterator<CSSTransformComponent>;
32
+ entries(): IterableIterator<[number, CSSTransformComponent]>;
33
+ keys(): IterableIterator<number>;
34
+ values(): IterableIterator<CSSTransformComponent>;
35
+ }
36
+
37
+ interface CSSUnparsedValue {
38
+ [Symbol.iterator](): IterableIterator<CSSUnparsedSegment>;
39
+ entries(): IterableIterator<[number, CSSUnparsedSegment]>;
40
+ keys(): IterableIterator<number>;
41
+ values(): IterableIterator<CSSUnparsedSegment>;
42
+ }
43
+
23
44
  interface Cache {
24
45
  addAll(requests: Iterable<RequestInfo>): Promise<void>;
25
46
  }
@@ -82,6 +103,13 @@ interface MessageEvent<T = any> {
82
103
  initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
83
104
  }
84
105
 
106
+ interface StylePropertyMapReadOnly {
107
+ [Symbol.iterator](): IterableIterator<[string, Iterable<CSSStyleValue>]>;
108
+ entries(): IterableIterator<[string, Iterable<CSSStyleValue>]>;
109
+ keys(): IterableIterator<string>;
110
+ values(): IterableIterator<Iterable<CSSStyleValue>>;
111
+ }
112
+
85
113
  interface SubtleCrypto {
86
114
  deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
87
115
  generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-dev.20230308`;
26
+ var version = `${versionMajorMinor}.0-dev.20230310`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -4876,20 +4876,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
4876
4876
  (path2) => sys2.directoryExists(path2)
4877
4877
  );
4878
4878
  }
4879
- function getNodeMajorVersion() {
4880
- if (typeof process === "undefined") {
4881
- return void 0;
4882
- }
4883
- const version2 = process.version;
4884
- if (!version2) {
4885
- return void 0;
4886
- }
4887
- const dot = version2.indexOf(".");
4888
- if (dot === -1) {
4889
- return void 0;
4890
- }
4891
- return parseInt(version2.substring(1, dot));
4892
- }
4893
4879
  var sys = (() => {
4894
4880
  const byteOrderMarkIndicator = "\uFEFF";
4895
4881
  function getNodeSystem() {
@@ -4906,14 +4892,12 @@ var sys = (() => {
4906
4892
  let activeSession;
4907
4893
  let profilePath = "./profile.cpuprofile";
4908
4894
  const Buffer2 = require("buffer").Buffer;
4909
- const nodeVersion = getNodeMajorVersion();
4910
- const isNode4OrLater = nodeVersion >= 4;
4911
4895
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4912
4896
  const platform = _os.platform();
4913
4897
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
4914
4898
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4915
4899
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4916
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
4900
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4917
4901
  const getCurrentDirectory = memoize(() => process.cwd());
4918
4902
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
4919
4903
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -41107,6 +41091,8 @@ function createBinder() {
41107
41091
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
41108
41092
  }
41109
41093
  break;
41094
+ case 265 /* ModuleDeclaration */:
41095
+ break;
41110
41096
  default:
41111
41097
  Debug.failBadSyntaxKind(thisContainer);
41112
41098
  }
@@ -52677,10 +52663,9 @@ function createTypeChecker(host) {
52677
52663
  return [sig.parameters];
52678
52664
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
52679
52665
  const elementTypes = getTypeArguments(restType);
52680
- const associatedNames = restType.target.labeledElementDeclarations;
52666
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
52681
52667
  const restParams = map(elementTypes, (t, i) => {
52682
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
52683
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
52668
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
52684
52669
  const flags = restType.target.elementFlags[i];
52685
52670
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
52686
52671
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -52689,6 +52674,20 @@ function createTypeChecker(host) {
52689
52674
  });
52690
52675
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
52691
52676
  }
52677
+ function getUniqAssociatedNamesFromTupleType(type) {
52678
+ const associatedNamesMap = /* @__PURE__ */ new Map();
52679
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
52680
+ const name = getTupleElementLabel(labeledElement);
52681
+ const prevCounter = associatedNamesMap.get(name);
52682
+ if (prevCounter === void 0) {
52683
+ associatedNamesMap.set(name, 1);
52684
+ return name;
52685
+ } else {
52686
+ associatedNamesMap.set(name, prevCounter + 1);
52687
+ return `${name}_${prevCounter}`;
52688
+ }
52689
+ });
52690
+ }
52692
52691
  }
52693
52692
  function getDefaultConstructSignatures(classType) {
52694
52693
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -67268,13 +67267,14 @@ function createTypeChecker(host) {
67268
67267
  const elementFlags = [];
67269
67268
  pushCachedContextualType(node);
67270
67269
  const inDestructuringPattern = isAssignmentTarget(node);
67271
- const inConstContext = isConstContext(node);
67270
+ const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
67271
+ const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
67272
67272
  const contextualType = getApparentTypeOfContextualType(
67273
67273
  node,
67274
67274
  /*contextFlags*/
67275
67275
  void 0
67276
67276
  );
67277
- const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
67277
+ const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
67278
67278
  let hasOmittedExpression = false;
67279
67279
  for (let i = 0; i < elementCount; i++) {
67280
67280
  const e = elements[i];
@@ -74870,8 +74870,7 @@ function createTypeChecker(host) {
74870
74870
  const subsequentName = subsequentNode.name;
74871
74871
  if (node.name && subsequentName && // both are private identifiers
74872
74872
  (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names
74873
- // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!)
74874
- isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) || // Both are literal property names that are the same.
74873
+ isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same.
74875
74874
  isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
74876
74875
  const reportError = (node.kind === 172 /* MethodDeclaration */ || node.kind === 171 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
74877
74876
  if (reportError) {
package/lib/tsserver.js CHANGED
@@ -883,7 +883,6 @@ __export(server_exports, {
883
883
  getNodeForGeneratedName: () => getNodeForGeneratedName,
884
884
  getNodeId: () => getNodeId,
885
885
  getNodeKind: () => getNodeKind,
886
- getNodeMajorVersion: () => getNodeMajorVersion,
887
886
  getNodeModifiers: () => getNodeModifiers,
888
887
  getNodeModulePathParts: () => getNodeModulePathParts,
889
888
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -2285,7 +2284,7 @@ module.exports = __toCommonJS(server_exports);
2285
2284
 
2286
2285
  // src/compiler/corePublic.ts
2287
2286
  var versionMajorMinor = "5.1";
2288
- var version = `${versionMajorMinor}.0-dev.20230308`;
2287
+ var version = `${versionMajorMinor}.0-dev.20230310`;
2289
2288
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2289
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2290
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8315,20 +8314,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
8315
8314
  (path2) => sys2.directoryExists(path2)
8316
8315
  );
8317
8316
  }
8318
- function getNodeMajorVersion() {
8319
- if (typeof process === "undefined") {
8320
- return void 0;
8321
- }
8322
- const version2 = process.version;
8323
- if (!version2) {
8324
- return void 0;
8325
- }
8326
- const dot = version2.indexOf(".");
8327
- if (dot === -1) {
8328
- return void 0;
8329
- }
8330
- return parseInt(version2.substring(1, dot));
8331
- }
8332
8317
  var sys = (() => {
8333
8318
  const byteOrderMarkIndicator = "\uFEFF";
8334
8319
  function getNodeSystem() {
@@ -8345,14 +8330,12 @@ var sys = (() => {
8345
8330
  let activeSession;
8346
8331
  let profilePath = "./profile.cpuprofile";
8347
8332
  const Buffer2 = require("buffer").Buffer;
8348
- const nodeVersion = getNodeMajorVersion();
8349
- const isNode4OrLater = nodeVersion >= 4;
8350
8333
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
8351
8334
  const platform = _os.platform();
8352
8335
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
8353
8336
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
8354
8337
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
8355
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
8338
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
8356
8339
  const getCurrentDirectory = memoize(() => process.cwd());
8357
8340
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
8358
8341
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -45649,6 +45632,8 @@ function createBinder() {
45649
45632
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
45650
45633
  }
45651
45634
  break;
45635
+ case 265 /* ModuleDeclaration */:
45636
+ break;
45652
45637
  default:
45653
45638
  Debug.failBadSyntaxKind(thisContainer);
45654
45639
  }
@@ -57267,10 +57252,9 @@ function createTypeChecker(host) {
57267
57252
  return [sig.parameters];
57268
57253
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
57269
57254
  const elementTypes = getTypeArguments(restType);
57270
- const associatedNames = restType.target.labeledElementDeclarations;
57255
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
57271
57256
  const restParams = map(elementTypes, (t, i) => {
57272
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
57273
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
57257
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
57274
57258
  const flags = restType.target.elementFlags[i];
57275
57259
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
57276
57260
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -57279,6 +57263,20 @@ function createTypeChecker(host) {
57279
57263
  });
57280
57264
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
57281
57265
  }
57266
+ function getUniqAssociatedNamesFromTupleType(type) {
57267
+ const associatedNamesMap = /* @__PURE__ */ new Map();
57268
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
57269
+ const name = getTupleElementLabel(labeledElement);
57270
+ const prevCounter = associatedNamesMap.get(name);
57271
+ if (prevCounter === void 0) {
57272
+ associatedNamesMap.set(name, 1);
57273
+ return name;
57274
+ } else {
57275
+ associatedNamesMap.set(name, prevCounter + 1);
57276
+ return `${name}_${prevCounter}`;
57277
+ }
57278
+ });
57279
+ }
57282
57280
  }
57283
57281
  function getDefaultConstructSignatures(classType) {
57284
57282
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -71858,13 +71856,14 @@ function createTypeChecker(host) {
71858
71856
  const elementFlags = [];
71859
71857
  pushCachedContextualType(node);
71860
71858
  const inDestructuringPattern = isAssignmentTarget(node);
71861
- const inConstContext = isConstContext(node);
71859
+ const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
71860
+ const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
71862
71861
  const contextualType = getApparentTypeOfContextualType(
71863
71862
  node,
71864
71863
  /*contextFlags*/
71865
71864
  void 0
71866
71865
  );
71867
- const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
71866
+ const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
71868
71867
  let hasOmittedExpression = false;
71869
71868
  for (let i = 0; i < elementCount; i++) {
71870
71869
  const e = elements[i];
@@ -79460,8 +79459,7 @@ function createTypeChecker(host) {
79460
79459
  const subsequentName = subsequentNode.name;
79461
79460
  if (node.name && subsequentName && // both are private identifiers
79462
79461
  (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names
79463
- // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!)
79464
- isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) || // Both are literal property names that are the same.
79462
+ isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same.
79465
79463
  isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
79466
79464
  const reportError = (node.kind === 172 /* MethodDeclaration */ || node.kind === 171 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
79467
79465
  if (reportError) {
@@ -143983,9 +143981,10 @@ function getInfo7(sourceFile, tokenPos, errorCode, checker, program) {
143983
143981
  if (!isMemberName(token))
143984
143982
  return void 0;
143985
143983
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
143984
+ const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
143986
143985
  const properties = arrayFrom(checker.getUnmatchedProperties(
143987
143986
  checker.getTypeAtLocation(parent2.initializer),
143988
- checker.getTypeAtLocation(token),
143987
+ targetType,
143989
143988
  /* requireOptionalProperties */
143990
143989
  false,
143991
143990
  /* matchDiscriminantProperties */
@@ -168865,7 +168864,6 @@ __export(ts_exports3, {
168865
168864
  getNodeForGeneratedName: () => getNodeForGeneratedName,
168866
168865
  getNodeId: () => getNodeId,
168867
168866
  getNodeKind: () => getNodeKind,
168868
- getNodeMajorVersion: () => getNodeMajorVersion,
168869
168867
  getNodeModifiers: () => getNodeModifiers,
168870
168868
  getNodeModulePathParts: () => getNodeModulePathParts,
168871
168869
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -181391,8 +181389,7 @@ function initializeNodeSystem() {
181391
181389
  }
181392
181390
  }
181393
181391
  const libDirectory = getDirectoryPath(normalizePath(sys2.getExecutingFilePath()));
181394
- const nodeVersion = getNodeMajorVersion();
181395
- const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
181392
+ const useWatchGuard = process.platform === "win32";
181396
181393
  const originalWatchDirectory = sys2.watchDirectory.bind(sys2);
181397
181394
  const logger = createLogger();
181398
181395
  Debug.loggingHost = {
@@ -181947,7 +181944,7 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
181947
181944
  logger.info(`Starting TS Server`);
181948
181945
  logger.info(`Version: ${version}`);
181949
181946
  logger.info(`Arguments: ${args.join(" ")}`);
181950
- logger.info(`Platform: ${platform} NodeVersion: ${getNodeMajorVersion()} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
181947
+ logger.info(`Platform: ${platform} NodeVersion: ${process.version} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
181951
181948
  logger.info(`ServerMode: ${serverMode} hasUnknownServerMode: ${unknownServerMode}`);
181952
181949
  setStackTraceLimit();
181953
181950
  if (Debug.isDebugging) {
@@ -182825,7 +182822,6 @@ start(initializeNodeSystem(), require("os").platform());
182825
182822
  getNodeForGeneratedName,
182826
182823
  getNodeId,
182827
182824
  getNodeKind,
182828
- getNodeMajorVersion,
182829
182825
  getNodeModifiers,
182830
182826
  getNodeModulePathParts,
182831
182827
  getNonAssignedNameOfDeclaration,
@@ -8285,7 +8285,6 @@ declare namespace ts {
8285
8285
  negative: boolean;
8286
8286
  base10Value: string;
8287
8287
  }
8288
- function getNodeMajorVersion(): number | undefined;
8289
8288
  enum FileWatcherEventKind {
8290
8289
  Created = 0,
8291
8290
  Changed = 1,
@@ -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.20230308`;
38
+ version = `${versionMajorMinor}.0-dev.20230310`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6098,20 +6098,6 @@ ${lanes.join("\n")}
6098
6098
  (path2) => sys2.directoryExists(path2)
6099
6099
  );
6100
6100
  }
6101
- function getNodeMajorVersion() {
6102
- if (typeof process === "undefined") {
6103
- return void 0;
6104
- }
6105
- const version2 = process.version;
6106
- if (!version2) {
6107
- return void 0;
6108
- }
6109
- const dot = version2.indexOf(".");
6110
- if (dot === -1) {
6111
- return void 0;
6112
- }
6113
- return parseInt(version2.substring(1, dot));
6114
- }
6115
6101
  function setSys(s) {
6116
6102
  sys = s;
6117
6103
  }
@@ -6159,14 +6145,12 @@ ${lanes.join("\n")}
6159
6145
  let activeSession;
6160
6146
  let profilePath = "./profile.cpuprofile";
6161
6147
  const Buffer2 = require("buffer").Buffer;
6162
- const nodeVersion = getNodeMajorVersion();
6163
- const isNode4OrLater = nodeVersion >= 4;
6164
6148
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6165
6149
  const platform = _os.platform();
6166
6150
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
6167
6151
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6168
6152
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6169
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
6153
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6170
6154
  const getCurrentDirectory = memoize(() => process.cwd());
6171
6155
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6172
6156
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -43552,6 +43536,8 @@ ${lanes.join("\n")}
43552
43536
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
43553
43537
  }
43554
43538
  break;
43539
+ case 265 /* ModuleDeclaration */:
43540
+ break;
43555
43541
  default:
43556
43542
  Debug.failBadSyntaxKind(thisContainer);
43557
43543
  }
@@ -55078,10 +55064,9 @@ ${lanes.join("\n")}
55078
55064
  return [sig.parameters];
55079
55065
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55080
55066
  const elementTypes = getTypeArguments(restType);
55081
- const associatedNames = restType.target.labeledElementDeclarations;
55067
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55082
55068
  const restParams = map(elementTypes, (t, i) => {
55083
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
55084
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
55069
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55085
55070
  const flags = restType.target.elementFlags[i];
55086
55071
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
55087
55072
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -55090,6 +55075,20 @@ ${lanes.join("\n")}
55090
55075
  });
55091
55076
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55092
55077
  }
55078
+ function getUniqAssociatedNamesFromTupleType(type) {
55079
+ const associatedNamesMap = /* @__PURE__ */ new Map();
55080
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55081
+ const name = getTupleElementLabel(labeledElement);
55082
+ const prevCounter = associatedNamesMap.get(name);
55083
+ if (prevCounter === void 0) {
55084
+ associatedNamesMap.set(name, 1);
55085
+ return name;
55086
+ } else {
55087
+ associatedNamesMap.set(name, prevCounter + 1);
55088
+ return `${name}_${prevCounter}`;
55089
+ }
55090
+ });
55091
+ }
55093
55092
  }
55094
55093
  function getDefaultConstructSignatures(classType) {
55095
55094
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -69669,13 +69668,14 @@ ${lanes.join("\n")}
69669
69668
  const elementFlags = [];
69670
69669
  pushCachedContextualType(node);
69671
69670
  const inDestructuringPattern = isAssignmentTarget(node);
69672
- const inConstContext = isConstContext(node);
69671
+ const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
69672
+ const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
69673
69673
  const contextualType = getApparentTypeOfContextualType(
69674
69674
  node,
69675
69675
  /*contextFlags*/
69676
69676
  void 0
69677
69677
  );
69678
- const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
69678
+ const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
69679
69679
  let hasOmittedExpression = false;
69680
69680
  for (let i = 0; i < elementCount; i++) {
69681
69681
  const e = elements[i];
@@ -77271,8 +77271,7 @@ ${lanes.join("\n")}
77271
77271
  const subsequentName = subsequentNode.name;
77272
77272
  if (node.name && subsequentName && // both are private identifiers
77273
77273
  (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names
77274
- // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!)
77275
- isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) || // Both are literal property names that are the same.
77274
+ isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same.
77276
77275
  isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
77277
77276
  const reportError = (node.kind === 172 /* MethodDeclaration */ || node.kind === 171 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
77278
77277
  if (reportError) {
@@ -142574,9 +142573,10 @@ ${lanes.join("\n")}
142574
142573
  if (!isMemberName(token))
142575
142574
  return void 0;
142576
142575
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
142576
+ const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
142577
142577
  const properties = arrayFrom(checker.getUnmatchedProperties(
142578
142578
  checker.getTypeAtLocation(parent2.initializer),
142579
- checker.getTypeAtLocation(token),
142579
+ targetType,
142580
142580
  /* requireOptionalProperties */
142581
142581
  false,
142582
142582
  /* matchDiscriminantProperties */
@@ -179474,7 +179474,6 @@ ${e.message}`;
179474
179474
  getNodeForGeneratedName: () => getNodeForGeneratedName,
179475
179475
  getNodeId: () => getNodeId,
179476
179476
  getNodeKind: () => getNodeKind,
179477
- getNodeMajorVersion: () => getNodeMajorVersion,
179478
179477
  getNodeModifiers: () => getNodeModifiers,
179479
179478
  getNodeModulePathParts: () => getNodeModulePathParts,
179480
179479
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -181831,7 +181830,6 @@ ${e.message}`;
181831
181830
  getNodeForGeneratedName: () => getNodeForGeneratedName,
181832
181831
  getNodeId: () => getNodeId,
181833
181832
  getNodeKind: () => getNodeKind,
181834
- getNodeMajorVersion: () => getNodeMajorVersion,
181835
181833
  getNodeModifiers: () => getNodeModifiers,
181836
181834
  getNodeModulePathParts: () => getNodeModulePathParts,
181837
181835
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
@@ -4342,7 +4342,6 @@ declare namespace ts {
4342
4342
  negative: boolean;
4343
4343
  base10Value: string;
4344
4344
  }
4345
- function getNodeMajorVersion(): number | undefined;
4346
4345
  enum FileWatcherEventKind {
4347
4346
  Created = 0,
4348
4347
  Changed = 1,
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230308`;
38
+ version = `${versionMajorMinor}.0-dev.20230310`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6098,20 +6098,6 @@ ${lanes.join("\n")}
6098
6098
  (path2) => sys2.directoryExists(path2)
6099
6099
  );
6100
6100
  }
6101
- function getNodeMajorVersion() {
6102
- if (typeof process === "undefined") {
6103
- return void 0;
6104
- }
6105
- const version2 = process.version;
6106
- if (!version2) {
6107
- return void 0;
6108
- }
6109
- const dot = version2.indexOf(".");
6110
- if (dot === -1) {
6111
- return void 0;
6112
- }
6113
- return parseInt(version2.substring(1, dot));
6114
- }
6115
6101
  function setSys(s) {
6116
6102
  sys = s;
6117
6103
  }
@@ -6159,14 +6145,12 @@ ${lanes.join("\n")}
6159
6145
  let activeSession;
6160
6146
  let profilePath = "./profile.cpuprofile";
6161
6147
  const Buffer2 = require("buffer").Buffer;
6162
- const nodeVersion = getNodeMajorVersion();
6163
- const isNode4OrLater = nodeVersion >= 4;
6164
6148
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6165
6149
  const platform = _os.platform();
6166
6150
  const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
6167
6151
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6168
6152
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6169
- const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
6153
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6170
6154
  const getCurrentDirectory = memoize(() => process.cwd());
6171
6155
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6172
6156
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -43552,6 +43536,8 @@ ${lanes.join("\n")}
43552
43536
  declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */);
43553
43537
  }
43554
43538
  break;
43539
+ case 265 /* ModuleDeclaration */:
43540
+ break;
43555
43541
  default:
43556
43542
  Debug.failBadSyntaxKind(thisContainer);
43557
43543
  }
@@ -55078,10 +55064,9 @@ ${lanes.join("\n")}
55078
55064
  return [sig.parameters];
55079
55065
  function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55080
55066
  const elementTypes = getTypeArguments(restType);
55081
- const associatedNames = restType.target.labeledElementDeclarations;
55067
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55082
55068
  const restParams = map(elementTypes, (t, i) => {
55083
- const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]);
55084
- const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
55069
+ const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55085
55070
  const flags = restType.target.elementFlags[i];
55086
55071
  const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
55087
55072
  const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
@@ -55090,6 +55075,20 @@ ${lanes.join("\n")}
55090
55075
  });
55091
55076
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55092
55077
  }
55078
+ function getUniqAssociatedNamesFromTupleType(type) {
55079
+ const associatedNamesMap = /* @__PURE__ */ new Map();
55080
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55081
+ const name = getTupleElementLabel(labeledElement);
55082
+ const prevCounter = associatedNamesMap.get(name);
55083
+ if (prevCounter === void 0) {
55084
+ associatedNamesMap.set(name, 1);
55085
+ return name;
55086
+ } else {
55087
+ associatedNamesMap.set(name, prevCounter + 1);
55088
+ return `${name}_${prevCounter}`;
55089
+ }
55090
+ });
55091
+ }
55093
55092
  }
55094
55093
  function getDefaultConstructSignatures(classType) {
55095
55094
  const baseConstructorType = getBaseConstructorTypeOfClass(classType);
@@ -69669,13 +69668,14 @@ ${lanes.join("\n")}
69669
69668
  const elementFlags = [];
69670
69669
  pushCachedContextualType(node);
69671
69670
  const inDestructuringPattern = isAssignmentTarget(node);
69672
- const inConstContext = isConstContext(node);
69671
+ const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent);
69672
+ const inConstContext = isSpreadIntoCallOrNew || isConstContext(node);
69673
69673
  const contextualType = getApparentTypeOfContextualType(
69674
69674
  node,
69675
69675
  /*contextFlags*/
69676
69676
  void 0
69677
69677
  );
69678
- const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType);
69678
+ const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType);
69679
69679
  let hasOmittedExpression = false;
69680
69680
  for (let i = 0; i < elementCount; i++) {
69681
69681
  const e = elements[i];
@@ -77271,8 +77271,7 @@ ${lanes.join("\n")}
77271
77271
  const subsequentName = subsequentNode.name;
77272
77272
  if (node.name && subsequentName && // both are private identifiers
77273
77273
  (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names
77274
- // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!)
77275
- isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) || // Both are literal property names that are the same.
77274
+ isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same.
77276
77275
  isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
77277
77276
  const reportError = (node.kind === 172 /* MethodDeclaration */ || node.kind === 171 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode);
77278
77277
  if (reportError) {
@@ -142588,9 +142587,10 @@ ${lanes.join("\n")}
142588
142587
  if (!isMemberName(token))
142589
142588
  return void 0;
142590
142589
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
142590
+ const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
142591
142591
  const properties = arrayFrom(checker.getUnmatchedProperties(
142592
142592
  checker.getTypeAtLocation(parent2.initializer),
142593
- checker.getTypeAtLocation(token),
142593
+ targetType,
142594
142594
  /* requireOptionalProperties */
142595
142595
  false,
142596
142596
  /* matchDiscriminantProperties */
@@ -168642,7 +168642,6 @@ ${options.prefix}` : "\n" : options.prefix
168642
168642
  getNodeForGeneratedName: () => getNodeForGeneratedName,
168643
168643
  getNodeId: () => getNodeId,
168644
168644
  getNodeKind: () => getNodeKind,
168645
- getNodeMajorVersion: () => getNodeMajorVersion,
168646
168645
  getNodeModifiers: () => getNodeModifiers,
168647
168646
  getNodeModulePathParts: () => getNodeModulePathParts,
168648
168647
  getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,