@typescript-deploys/pr-build 5.1.0-pr-53258-7 → 5.1.0-pr-51196-8

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.1";
26
- var version = `${versionMajorMinor}.0-insiders.20230314`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230315`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -58866,12 +58866,7 @@ function createTypeChecker(host) {
58866
58866
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
58867
58867
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
58868
58868
  for (let i = 0; i < paramCount; i++) {
58869
- const sourceType = i === restIndex ? getRestTypeAtPosition(
58870
- source,
58871
- i,
58872
- /*readonly*/
58873
- true
58874
- ) : tryGetTypeAtPosition(source, i);
58869
+ const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
58875
58870
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
58876
58871
  if (sourceType && targetType) {
58877
58872
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -66402,7 +66397,21 @@ function createTypeChecker(host) {
66402
66397
  }
66403
66398
  const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
66404
66399
  if (signature && !isResolvingReturnTypeOfSignature(signature)) {
66405
- return getReturnTypeOfSignature(signature);
66400
+ const functionFlags = getFunctionFlags(functionDecl);
66401
+ return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
66402
+ if (functionFlags & 1 /* Generator */) {
66403
+ return checkGeneratorInstantiationAssignabilityToReturnType(
66404
+ returnType2,
66405
+ functionFlags,
66406
+ /*errorNode*/
66407
+ void 0
66408
+ );
66409
+ }
66410
+ if (functionFlags & 2 /* Async */) {
66411
+ return !!getAwaitedTypeOfPromise(returnType2);
66412
+ }
66413
+ return true;
66414
+ });
66406
66415
  }
66407
66416
  const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
66408
66417
  if (iife) {
@@ -71356,12 +71365,12 @@ function createTypeChecker(host) {
71356
71365
  }
71357
71366
  return void 0;
71358
71367
  }
71359
- function getRestTypeAtPosition(source, pos, readonly = false) {
71368
+ function getRestTypeAtPosition(source, pos) {
71360
71369
  const parameterCount = getParameterCount(source);
71361
71370
  const minArgumentCount = getMinArgumentCount(source);
71362
71371
  const restType = getEffectiveRestType(source);
71363
71372
  if (restType && pos >= parameterCount - 1) {
71364
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
71373
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
71365
71374
  }
71366
71375
  const types = [];
71367
71376
  const flags = [];
@@ -71379,7 +71388,13 @@ function createTypeChecker(host) {
71379
71388
  names.push(name);
71380
71389
  }
71381
71390
  }
71382
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
71391
+ return createTupleType(
71392
+ types,
71393
+ flags,
71394
+ /*readonly*/
71395
+ false,
71396
+ length(names) === length(types) ? names : void 0
71397
+ );
71383
71398
  }
71384
71399
  function getParameterCount(signature) {
71385
71400
  const length2 = signature.parameters.length;
@@ -73368,7 +73383,15 @@ function createTypeChecker(host) {
73368
73383
  checkExternalEmitHelpers(node, 256 /* Values */);
73369
73384
  }
73370
73385
  }
73371
- const returnType = getReturnTypeFromAnnotation(func);
73386
+ let returnType = getReturnTypeFromAnnotation(func);
73387
+ if (returnType && returnType.flags & 1048576 /* Union */) {
73388
+ returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
73389
+ t,
73390
+ functionFlags,
73391
+ /*errorNode*/
73392
+ void 0
73393
+ ));
73394
+ }
73372
73395
  const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
73373
73396
  const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
73374
73397
  const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
@@ -74170,11 +74193,7 @@ function createTypeChecker(host) {
74170
74193
  if (returnType === voidType) {
74171
74194
  error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
74172
74195
  } else {
74173
- const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
74174
- const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
74175
- const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
74176
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
74177
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
74196
+ checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeNode);
74178
74197
  }
74179
74198
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
74180
74199
  checkAsyncFunctionReturnType(node, returnTypeNode);
@@ -74185,6 +74204,13 @@ function createTypeChecker(host) {
74185
74204
  }
74186
74205
  }
74187
74206
  }
74207
+ function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
74208
+ const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
74209
+ const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
74210
+ const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
74211
+ const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
74212
+ return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
74213
+ }
74188
74214
  function checkClassForDuplicateDeclarations(node) {
74189
74215
  const instanceNames = /* @__PURE__ */ new Map();
74190
74216
  const staticNames = /* @__PURE__ */ new Map();
package/lib/tsserver.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(server_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.1";
2288
- var version = `${versionMajorMinor}.0-insiders.20230314`;
2288
+ var version = `${versionMajorMinor}.0-insiders.20230315`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -63463,12 +63463,7 @@ function createTypeChecker(host) {
63463
63463
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
63464
63464
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
63465
63465
  for (let i = 0; i < paramCount; i++) {
63466
- const sourceType = i === restIndex ? getRestTypeAtPosition(
63467
- source,
63468
- i,
63469
- /*readonly*/
63470
- true
63471
- ) : tryGetTypeAtPosition(source, i);
63466
+ const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
63472
63467
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
63473
63468
  if (sourceType && targetType) {
63474
63469
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -70999,7 +70994,21 @@ function createTypeChecker(host) {
70999
70994
  }
71000
70995
  const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
71001
70996
  if (signature && !isResolvingReturnTypeOfSignature(signature)) {
71002
- return getReturnTypeOfSignature(signature);
70997
+ const functionFlags = getFunctionFlags(functionDecl);
70998
+ return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
70999
+ if (functionFlags & 1 /* Generator */) {
71000
+ return checkGeneratorInstantiationAssignabilityToReturnType(
71001
+ returnType2,
71002
+ functionFlags,
71003
+ /*errorNode*/
71004
+ void 0
71005
+ );
71006
+ }
71007
+ if (functionFlags & 2 /* Async */) {
71008
+ return !!getAwaitedTypeOfPromise(returnType2);
71009
+ }
71010
+ return true;
71011
+ });
71003
71012
  }
71004
71013
  const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
71005
71014
  if (iife) {
@@ -75953,12 +75962,12 @@ function createTypeChecker(host) {
75953
75962
  }
75954
75963
  return void 0;
75955
75964
  }
75956
- function getRestTypeAtPosition(source, pos, readonly = false) {
75965
+ function getRestTypeAtPosition(source, pos) {
75957
75966
  const parameterCount = getParameterCount(source);
75958
75967
  const minArgumentCount = getMinArgumentCount(source);
75959
75968
  const restType = getEffectiveRestType(source);
75960
75969
  if (restType && pos >= parameterCount - 1) {
75961
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
75970
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
75962
75971
  }
75963
75972
  const types = [];
75964
75973
  const flags = [];
@@ -75976,7 +75985,13 @@ function createTypeChecker(host) {
75976
75985
  names.push(name);
75977
75986
  }
75978
75987
  }
75979
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
75988
+ return createTupleType(
75989
+ types,
75990
+ flags,
75991
+ /*readonly*/
75992
+ false,
75993
+ length(names) === length(types) ? names : void 0
75994
+ );
75980
75995
  }
75981
75996
  function getParameterCount(signature) {
75982
75997
  const length2 = signature.parameters.length;
@@ -77965,7 +77980,15 @@ function createTypeChecker(host) {
77965
77980
  checkExternalEmitHelpers(node, 256 /* Values */);
77966
77981
  }
77967
77982
  }
77968
- const returnType = getReturnTypeFromAnnotation(func);
77983
+ let returnType = getReturnTypeFromAnnotation(func);
77984
+ if (returnType && returnType.flags & 1048576 /* Union */) {
77985
+ returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
77986
+ t,
77987
+ functionFlags,
77988
+ /*errorNode*/
77989
+ void 0
77990
+ ));
77991
+ }
77969
77992
  const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
77970
77993
  const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
77971
77994
  const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
@@ -78767,11 +78790,7 @@ function createTypeChecker(host) {
78767
78790
  if (returnType === voidType) {
78768
78791
  error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
78769
78792
  } else {
78770
- const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
78771
- const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
78772
- const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
78773
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
78774
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
78793
+ checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeNode);
78775
78794
  }
78776
78795
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
78777
78796
  checkAsyncFunctionReturnType(node, returnTypeNode);
@@ -78782,6 +78801,13 @@ function createTypeChecker(host) {
78782
78801
  }
78783
78802
  }
78784
78803
  }
78804
+ function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
78805
+ const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
78806
+ const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
78807
+ const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
78808
+ const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
78809
+ return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
78810
+ }
78785
78811
  function checkClassForDuplicateDeclarations(node) {
78786
78812
  const instanceNames = /* @__PURE__ */ new Map();
78787
78813
  const staticNames = /* @__PURE__ */ new Map();
@@ -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-insiders.20230314`;
38
+ version = `${versionMajorMinor}.0-insiders.20230315`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -61274,12 +61274,7 @@ ${lanes.join("\n")}
61274
61274
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
61275
61275
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61276
61276
  for (let i = 0; i < paramCount; i++) {
61277
- const sourceType = i === restIndex ? getRestTypeAtPosition(
61278
- source,
61279
- i,
61280
- /*readonly*/
61281
- true
61282
- ) : tryGetTypeAtPosition(source, i);
61277
+ const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61283
61278
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61284
61279
  if (sourceType && targetType) {
61285
61280
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -68810,7 +68805,21 @@ ${lanes.join("\n")}
68810
68805
  }
68811
68806
  const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
68812
68807
  if (signature && !isResolvingReturnTypeOfSignature(signature)) {
68813
- return getReturnTypeOfSignature(signature);
68808
+ const functionFlags = getFunctionFlags(functionDecl);
68809
+ return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
68810
+ if (functionFlags & 1 /* Generator */) {
68811
+ return checkGeneratorInstantiationAssignabilityToReturnType(
68812
+ returnType2,
68813
+ functionFlags,
68814
+ /*errorNode*/
68815
+ void 0
68816
+ );
68817
+ }
68818
+ if (functionFlags & 2 /* Async */) {
68819
+ return !!getAwaitedTypeOfPromise(returnType2);
68820
+ }
68821
+ return true;
68822
+ });
68814
68823
  }
68815
68824
  const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
68816
68825
  if (iife) {
@@ -73764,12 +73773,12 @@ ${lanes.join("\n")}
73764
73773
  }
73765
73774
  return void 0;
73766
73775
  }
73767
- function getRestTypeAtPosition(source, pos, readonly = false) {
73776
+ function getRestTypeAtPosition(source, pos) {
73768
73777
  const parameterCount = getParameterCount(source);
73769
73778
  const minArgumentCount = getMinArgumentCount(source);
73770
73779
  const restType = getEffectiveRestType(source);
73771
73780
  if (restType && pos >= parameterCount - 1) {
73772
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
73781
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
73773
73782
  }
73774
73783
  const types = [];
73775
73784
  const flags = [];
@@ -73787,7 +73796,13 @@ ${lanes.join("\n")}
73787
73796
  names.push(name);
73788
73797
  }
73789
73798
  }
73790
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
73799
+ return createTupleType(
73800
+ types,
73801
+ flags,
73802
+ /*readonly*/
73803
+ false,
73804
+ length(names) === length(types) ? names : void 0
73805
+ );
73791
73806
  }
73792
73807
  function getParameterCount(signature) {
73793
73808
  const length2 = signature.parameters.length;
@@ -75776,7 +75791,15 @@ ${lanes.join("\n")}
75776
75791
  checkExternalEmitHelpers(node, 256 /* Values */);
75777
75792
  }
75778
75793
  }
75779
- const returnType = getReturnTypeFromAnnotation(func);
75794
+ let returnType = getReturnTypeFromAnnotation(func);
75795
+ if (returnType && returnType.flags & 1048576 /* Union */) {
75796
+ returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
75797
+ t,
75798
+ functionFlags,
75799
+ /*errorNode*/
75800
+ void 0
75801
+ ));
75802
+ }
75780
75803
  const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
75781
75804
  const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
75782
75805
  const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
@@ -76578,11 +76601,7 @@ ${lanes.join("\n")}
76578
76601
  if (returnType === voidType) {
76579
76602
  error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
76580
76603
  } else {
76581
- const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
76582
- const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
76583
- const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
76584
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
76585
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
76604
+ checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeNode);
76586
76605
  }
76587
76606
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
76588
76607
  checkAsyncFunctionReturnType(node, returnTypeNode);
@@ -76593,6 +76612,13 @@ ${lanes.join("\n")}
76593
76612
  }
76594
76613
  }
76595
76614
  }
76615
+ function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
76616
+ const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
76617
+ const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
76618
+ const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
76619
+ const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
76620
+ return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
76621
+ }
76596
76622
  function checkClassForDuplicateDeclarations(node) {
76597
76623
  const instanceNames = /* @__PURE__ */ new Map();
76598
76624
  const staticNames = /* @__PURE__ */ new Map();
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-insiders.20230314`;
38
+ version = `${versionMajorMinor}.0-insiders.20230315`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -61274,12 +61274,7 @@ ${lanes.join("\n")}
61274
61274
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
61275
61275
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
61276
61276
  for (let i = 0; i < paramCount; i++) {
61277
- const sourceType = i === restIndex ? getRestTypeAtPosition(
61278
- source,
61279
- i,
61280
- /*readonly*/
61281
- true
61282
- ) : tryGetTypeAtPosition(source, i);
61277
+ const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
61283
61278
  const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
61284
61279
  if (sourceType && targetType) {
61285
61280
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
@@ -68810,7 +68805,21 @@ ${lanes.join("\n")}
68810
68805
  }
68811
68806
  const signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl);
68812
68807
  if (signature && !isResolvingReturnTypeOfSignature(signature)) {
68813
- return getReturnTypeOfSignature(signature);
68808
+ const functionFlags = getFunctionFlags(functionDecl);
68809
+ return filterType(getReturnTypeOfSignature(signature), (returnType2) => {
68810
+ if (functionFlags & 1 /* Generator */) {
68811
+ return checkGeneratorInstantiationAssignabilityToReturnType(
68812
+ returnType2,
68813
+ functionFlags,
68814
+ /*errorNode*/
68815
+ void 0
68816
+ );
68817
+ }
68818
+ if (functionFlags & 2 /* Async */) {
68819
+ return !!getAwaitedTypeOfPromise(returnType2);
68820
+ }
68821
+ return true;
68822
+ });
68814
68823
  }
68815
68824
  const iife = getImmediatelyInvokedFunctionExpression(functionDecl);
68816
68825
  if (iife) {
@@ -73764,12 +73773,12 @@ ${lanes.join("\n")}
73764
73773
  }
73765
73774
  return void 0;
73766
73775
  }
73767
- function getRestTypeAtPosition(source, pos, readonly = false) {
73776
+ function getRestTypeAtPosition(source, pos) {
73768
73777
  const parameterCount = getParameterCount(source);
73769
73778
  const minArgumentCount = getMinArgumentCount(source);
73770
73779
  const restType = getEffectiveRestType(source);
73771
73780
  if (restType && pos >= parameterCount - 1) {
73772
- return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
73781
+ return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
73773
73782
  }
73774
73783
  const types = [];
73775
73784
  const flags = [];
@@ -73787,7 +73796,13 @@ ${lanes.join("\n")}
73787
73796
  names.push(name);
73788
73797
  }
73789
73798
  }
73790
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
73799
+ return createTupleType(
73800
+ types,
73801
+ flags,
73802
+ /*readonly*/
73803
+ false,
73804
+ length(names) === length(types) ? names : void 0
73805
+ );
73791
73806
  }
73792
73807
  function getParameterCount(signature) {
73793
73808
  const length2 = signature.parameters.length;
@@ -75776,7 +75791,15 @@ ${lanes.join("\n")}
75776
75791
  checkExternalEmitHelpers(node, 256 /* Values */);
75777
75792
  }
75778
75793
  }
75779
- const returnType = getReturnTypeFromAnnotation(func);
75794
+ let returnType = getReturnTypeFromAnnotation(func);
75795
+ if (returnType && returnType.flags & 1048576 /* Union */) {
75796
+ returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(
75797
+ t,
75798
+ functionFlags,
75799
+ /*errorNode*/
75800
+ void 0
75801
+ ));
75802
+ }
75780
75803
  const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync);
75781
75804
  const signatureYieldType = iterationTypes && iterationTypes.yieldType || anyType;
75782
75805
  const signatureNextType = iterationTypes && iterationTypes.nextType || anyType;
@@ -76578,11 +76601,7 @@ ${lanes.join("\n")}
76578
76601
  if (returnType === voidType) {
76579
76602
  error(returnTypeNode, Diagnostics.A_generator_cannot_have_a_void_type_annotation);
76580
76603
  } else {
76581
- const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || anyType;
76582
- const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || generatorYieldType;
76583
- const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags2 & 2 /* Async */) !== 0) || unknownType;
76584
- const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags2 & 2 /* Async */));
76585
- checkTypeAssignableTo(generatorInstantiation, returnType, returnTypeNode);
76604
+ checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags2, returnTypeNode);
76586
76605
  }
76587
76606
  } else if ((functionFlags2 & 3 /* AsyncGenerator */) === 2 /* Async */) {
76588
76607
  checkAsyncFunctionReturnType(node, returnTypeNode);
@@ -76593,6 +76612,13 @@ ${lanes.join("\n")}
76593
76612
  }
76594
76613
  }
76595
76614
  }
76615
+ function checkGeneratorInstantiationAssignabilityToReturnType(returnType, functionFlags, errorNode) {
76616
+ const generatorYieldType = getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, returnType, (functionFlags & 2 /* Async */) !== 0) || anyType;
76617
+ const generatorReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, (functionFlags & 2 /* Async */) !== 0) || generatorYieldType;
76618
+ const generatorNextType = getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, (functionFlags & 2 /* Async */) !== 0) || unknownType;
76619
+ const generatorInstantiation = createGeneratorReturnType(generatorYieldType, generatorReturnType, generatorNextType, !!(functionFlags & 2 /* Async */));
76620
+ return checkTypeAssignableTo(generatorInstantiation, returnType, errorNode);
76621
+ }
76596
76622
  function checkClassForDuplicateDeclarations(node) {
76597
76623
  const instanceNames = /* @__PURE__ */ new Map();
76598
76624
  const staticNames = /* @__PURE__ */ new Map();
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-insiders.20230314`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230315`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-pr-53258-7",
5
+ "version": "5.1.0-pr-51196-8",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -78,6 +78,7 @@
78
78
  "ms": "^2.1.3",
79
79
  "node-fetch": "^3.2.10",
80
80
  "source-map-support": "^0.5.21",
81
+ "tslib": "^2.5.0",
81
82
  "typescript": "5.0.1-rc",
82
83
  "which": "^2.0.2"
83
84
  },
@@ -113,5 +114,5 @@
113
114
  "node": "14.21.1",
114
115
  "npm": "8.19.3"
115
116
  },
116
- "gitHead": "e2135808035b5ef94c2174f2d42b67d08f8e0f24"
117
+ "gitHead": "5df613abbc809e053211272f3e5d03ee7a856f8a"
117
118
  }