typescript 5.0.0-dev.20230218 → 5.0.0-dev.20230219

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.
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.0";
26
- var version = `${versionMajorMinor}.0-dev.20230218`;
26
+ var version = `${versionMajorMinor}.0-dev.20230219`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -61927,7 +61927,7 @@ function createTypeChecker(host) {
61927
61927
  const restType = getRestTypeOfTupleType(type);
61928
61928
  return restType && createArrayType(restType);
61929
61929
  }
61930
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
61930
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
61931
61931
  const length2 = getTypeReferenceArity(type) - endSkipCount;
61932
61932
  if (index < length2) {
61933
61933
  const typeArguments = getTypeArguments(type);
@@ -61936,7 +61936,7 @@ function createTypeChecker(host) {
61936
61936
  const t = typeArguments[i];
61937
61937
  elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
61938
61938
  }
61939
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
61939
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
61940
61940
  }
61941
61941
  return void 0;
61942
61942
  }
@@ -66523,9 +66523,18 @@ function createTypeChecker(host) {
66523
66523
  if (prop) {
66524
66524
  return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
66525
66525
  }
66526
- if (isTupleType(t)) {
66527
- const restType = getRestTypeOfTupleType(t);
66528
- if (restType && isNumericLiteralName(name) && +name >= 0) {
66526
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
66527
+ const restType = getElementTypeOfSliceOfTupleType(
66528
+ t,
66529
+ t.target.fixedLength,
66530
+ /*endSkipCount*/
66531
+ 0,
66532
+ /*writing*/
66533
+ false,
66534
+ /*noReductions*/
66535
+ true
66536
+ );
66537
+ if (restType) {
66529
66538
  return restType;
66530
66539
  }
66531
66540
  }
@@ -66572,9 +66581,18 @@ function createTypeChecker(host) {
66572
66581
  return void 0;
66573
66582
  }
66574
66583
  function getContextualTypeForElementExpression(arrayContextualType, index) {
66575
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
66584
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
66576
66585
  arrayContextualType,
66577
- (t) => getIteratedTypeOrElementType(
66586
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
66587
+ t,
66588
+ 0,
66589
+ /*endSkipCount*/
66590
+ 0,
66591
+ /*writing*/
66592
+ false,
66593
+ /*noReductions*/
66594
+ true
66595
+ ) : getIteratedTypeOrElementType(
66578
66596
  1 /* Element */,
66579
66597
  t,
66580
66598
  undefinedType,
@@ -66727,6 +66745,7 @@ function createTypeChecker(host) {
66727
66745
  return type;
66728
66746
  }
66729
66747
  function getContextualType(node, contextFlags) {
66748
+ var _a2, _b;
66730
66749
  if (node.flags & 33554432 /* InWithStatement */) {
66731
66750
  return void 0;
66732
66751
  }
@@ -66771,7 +66790,9 @@ function createTypeChecker(host) {
66771
66790
  case 206 /* ArrayLiteralExpression */: {
66772
66791
  const arrayLiteral = parent;
66773
66792
  const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
66774
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
66793
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
66794
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
66795
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
66775
66796
  }
66776
66797
  case 224 /* ConditionalExpression */:
66777
66798
  return getContextualTypeForConditionalOperand(node, contextFlags);
package/lib/tsserver.js CHANGED
@@ -2288,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
2288
2288
 
2289
2289
  // src/compiler/corePublic.ts
2290
2290
  var versionMajorMinor = "5.0";
2291
- var version = `${versionMajorMinor}.0-dev.20230218`;
2291
+ var version = `${versionMajorMinor}.0-dev.20230219`;
2292
2292
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2293
2293
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2294
2294
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -66534,7 +66534,7 @@ function createTypeChecker(host) {
66534
66534
  const restType = getRestTypeOfTupleType(type);
66535
66535
  return restType && createArrayType(restType);
66536
66536
  }
66537
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
66537
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
66538
66538
  const length2 = getTypeReferenceArity(type) - endSkipCount;
66539
66539
  if (index < length2) {
66540
66540
  const typeArguments = getTypeArguments(type);
@@ -66543,7 +66543,7 @@ function createTypeChecker(host) {
66543
66543
  const t = typeArguments[i];
66544
66544
  elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
66545
66545
  }
66546
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
66546
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
66547
66547
  }
66548
66548
  return void 0;
66549
66549
  }
@@ -71130,9 +71130,18 @@ function createTypeChecker(host) {
71130
71130
  if (prop) {
71131
71131
  return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
71132
71132
  }
71133
- if (isTupleType(t)) {
71134
- const restType = getRestTypeOfTupleType(t);
71135
- if (restType && isNumericLiteralName(name) && +name >= 0) {
71133
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
71134
+ const restType = getElementTypeOfSliceOfTupleType(
71135
+ t,
71136
+ t.target.fixedLength,
71137
+ /*endSkipCount*/
71138
+ 0,
71139
+ /*writing*/
71140
+ false,
71141
+ /*noReductions*/
71142
+ true
71143
+ );
71144
+ if (restType) {
71136
71145
  return restType;
71137
71146
  }
71138
71147
  }
@@ -71179,9 +71188,18 @@ function createTypeChecker(host) {
71179
71188
  return void 0;
71180
71189
  }
71181
71190
  function getContextualTypeForElementExpression(arrayContextualType, index) {
71182
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
71191
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
71183
71192
  arrayContextualType,
71184
- (t) => getIteratedTypeOrElementType(
71193
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
71194
+ t,
71195
+ 0,
71196
+ /*endSkipCount*/
71197
+ 0,
71198
+ /*writing*/
71199
+ false,
71200
+ /*noReductions*/
71201
+ true
71202
+ ) : getIteratedTypeOrElementType(
71185
71203
  1 /* Element */,
71186
71204
  t,
71187
71205
  undefinedType,
@@ -71334,6 +71352,7 @@ function createTypeChecker(host) {
71334
71352
  return type;
71335
71353
  }
71336
71354
  function getContextualType2(node, contextFlags) {
71355
+ var _a2, _b;
71337
71356
  if (node.flags & 33554432 /* InWithStatement */) {
71338
71357
  return void 0;
71339
71358
  }
@@ -71378,7 +71397,9 @@ function createTypeChecker(host) {
71378
71397
  case 206 /* ArrayLiteralExpression */: {
71379
71398
  const arrayLiteral = parent2;
71380
71399
  const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
71381
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
71400
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
71401
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
71402
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
71382
71403
  }
71383
71404
  case 224 /* ConditionalExpression */:
71384
71405
  return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.0";
38
- version = `${versionMajorMinor}.0-dev.20230218`;
38
+ version = `${versionMajorMinor}.0-dev.20230219`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -64342,7 +64342,7 @@ ${lanes.join("\n")}
64342
64342
  const restType = getRestTypeOfTupleType(type);
64343
64343
  return restType && createArrayType(restType);
64344
64344
  }
64345
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
64345
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
64346
64346
  const length2 = getTypeReferenceArity(type) - endSkipCount;
64347
64347
  if (index < length2) {
64348
64348
  const typeArguments = getTypeArguments(type);
@@ -64351,7 +64351,7 @@ ${lanes.join("\n")}
64351
64351
  const t = typeArguments[i];
64352
64352
  elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
64353
64353
  }
64354
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
64354
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
64355
64355
  }
64356
64356
  return void 0;
64357
64357
  }
@@ -68938,9 +68938,18 @@ ${lanes.join("\n")}
68938
68938
  if (prop) {
68939
68939
  return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
68940
68940
  }
68941
- if (isTupleType(t)) {
68942
- const restType = getRestTypeOfTupleType(t);
68943
- if (restType && isNumericLiteralName(name) && +name >= 0) {
68941
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
68942
+ const restType = getElementTypeOfSliceOfTupleType(
68943
+ t,
68944
+ t.target.fixedLength,
68945
+ /*endSkipCount*/
68946
+ 0,
68947
+ /*writing*/
68948
+ false,
68949
+ /*noReductions*/
68950
+ true
68951
+ );
68952
+ if (restType) {
68944
68953
  return restType;
68945
68954
  }
68946
68955
  }
@@ -68987,9 +68996,18 @@ ${lanes.join("\n")}
68987
68996
  return void 0;
68988
68997
  }
68989
68998
  function getContextualTypeForElementExpression(arrayContextualType, index) {
68990
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
68999
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
68991
69000
  arrayContextualType,
68992
- (t) => getIteratedTypeOrElementType(
69001
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
69002
+ t,
69003
+ 0,
69004
+ /*endSkipCount*/
69005
+ 0,
69006
+ /*writing*/
69007
+ false,
69008
+ /*noReductions*/
69009
+ true
69010
+ ) : getIteratedTypeOrElementType(
68993
69011
  1 /* Element */,
68994
69012
  t,
68995
69013
  undefinedType,
@@ -69142,6 +69160,7 @@ ${lanes.join("\n")}
69142
69160
  return type;
69143
69161
  }
69144
69162
  function getContextualType2(node, contextFlags) {
69163
+ var _a2, _b;
69145
69164
  if (node.flags & 33554432 /* InWithStatement */) {
69146
69165
  return void 0;
69147
69166
  }
@@ -69186,7 +69205,9 @@ ${lanes.join("\n")}
69186
69205
  case 206 /* ArrayLiteralExpression */: {
69187
69206
  const arrayLiteral = parent2;
69188
69207
  const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
69189
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
69208
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
69209
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
69210
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
69190
69211
  }
69191
69212
  case 224 /* ConditionalExpression */:
69192
69213
  return getContextualTypeForConditionalOperand(node, contextFlags);
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.0";
38
- version = `${versionMajorMinor}.0-dev.20230218`;
38
+ version = `${versionMajorMinor}.0-dev.20230219`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -64342,7 +64342,7 @@ ${lanes.join("\n")}
64342
64342
  const restType = getRestTypeOfTupleType(type);
64343
64343
  return restType && createArrayType(restType);
64344
64344
  }
64345
- function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
64345
+ function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
64346
64346
  const length2 = getTypeReferenceArity(type) - endSkipCount;
64347
64347
  if (index < length2) {
64348
64348
  const typeArguments = getTypeArguments(type);
@@ -64351,7 +64351,7 @@ ${lanes.join("\n")}
64351
64351
  const t = typeArguments[i];
64352
64352
  elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
64353
64353
  }
64354
- return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
64354
+ return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
64355
64355
  }
64356
64356
  return void 0;
64357
64357
  }
@@ -68938,9 +68938,18 @@ ${lanes.join("\n")}
68938
68938
  if (prop) {
68939
68939
  return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
68940
68940
  }
68941
- if (isTupleType(t)) {
68942
- const restType = getRestTypeOfTupleType(t);
68943
- if (restType && isNumericLiteralName(name) && +name >= 0) {
68941
+ if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
68942
+ const restType = getElementTypeOfSliceOfTupleType(
68943
+ t,
68944
+ t.target.fixedLength,
68945
+ /*endSkipCount*/
68946
+ 0,
68947
+ /*writing*/
68948
+ false,
68949
+ /*noReductions*/
68950
+ true
68951
+ );
68952
+ if (restType) {
68944
68953
  return restType;
68945
68954
  }
68946
68955
  }
@@ -68987,9 +68996,18 @@ ${lanes.join("\n")}
68987
68996
  return void 0;
68988
68997
  }
68989
68998
  function getContextualTypeForElementExpression(arrayContextualType, index) {
68990
- return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
68999
+ return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
68991
69000
  arrayContextualType,
68992
- (t) => getIteratedTypeOrElementType(
69001
+ (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
69002
+ t,
69003
+ 0,
69004
+ /*endSkipCount*/
69005
+ 0,
69006
+ /*writing*/
69007
+ false,
69008
+ /*noReductions*/
69009
+ true
69010
+ ) : getIteratedTypeOrElementType(
68993
69011
  1 /* Element */,
68994
69012
  t,
68995
69013
  undefinedType,
@@ -69142,6 +69160,7 @@ ${lanes.join("\n")}
69142
69160
  return type;
69143
69161
  }
69144
69162
  function getContextualType2(node, contextFlags) {
69163
+ var _a2, _b;
69145
69164
  if (node.flags & 33554432 /* InWithStatement */) {
69146
69165
  return void 0;
69147
69166
  }
@@ -69186,7 +69205,9 @@ ${lanes.join("\n")}
69186
69205
  case 206 /* ArrayLiteralExpression */: {
69187
69206
  const arrayLiteral = parent2;
69188
69207
  const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
69189
- return getContextualTypeForElementExpression(type, indexOfNode(arrayLiteral.elements, node));
69208
+ const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
69209
+ const elementIndex = indexOfNode(arrayLiteral.elements, node);
69210
+ return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
69190
69211
  }
69191
69212
  case 224 /* ConditionalExpression */:
69192
69213
  return getContextualTypeForConditionalOperand(node, contextFlags);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.0";
57
- var version = `${versionMajorMinor}.0-dev.20230218`;
57
+ var version = `${versionMajorMinor}.0-dev.20230219`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.0.0-dev.20230218",
5
+ "version": "5.0.0-dev.20230219",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [