typescript 6.0.0-dev.20251210 → 6.0.0-dev.20251211

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "6.0";
21
- var version = `${versionMajorMinor}.0-dev.20251210`;
21
+ var version = `${versionMajorMinor}.0-dev.20251211`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -14267,12 +14267,15 @@ function forEachYieldExpression(body, visitor) {
14267
14267
  function traverse(node) {
14268
14268
  switch (node.kind) {
14269
14269
  case 230 /* YieldExpression */:
14270
- visitor(node);
14270
+ const value = visitor(node);
14271
+ if (value) {
14272
+ return value;
14273
+ }
14271
14274
  const operand = node.expression;
14272
- if (operand) {
14273
- traverse(operand);
14275
+ if (!operand) {
14276
+ return;
14274
14277
  }
14275
- return;
14278
+ return traverse(operand);
14276
14279
  case 267 /* EnumDeclaration */:
14277
14280
  case 265 /* InterfaceDeclaration */:
14278
14281
  case 268 /* ModuleDeclaration */:
@@ -14281,11 +14284,10 @@ function forEachYieldExpression(body, visitor) {
14281
14284
  default:
14282
14285
  if (isFunctionLike(node)) {
14283
14286
  if (node.name && node.name.kind === 168 /* ComputedPropertyName */) {
14284
- traverse(node.name.expression);
14285
- return;
14287
+ return traverse(node.name.expression);
14286
14288
  }
14287
14289
  } else if (!isPartOfTypeNode(node)) {
14288
- forEachChild(node, traverse);
14290
+ return forEachChild(node, traverse);
14289
14291
  }
14290
14292
  }
14291
14293
  }
@@ -19129,7 +19131,7 @@ function hasContextSensitiveParameters(node) {
19129
19131
  if (node.kind !== 220 /* ArrowFunction */) {
19130
19132
  const parameter = firstOrUndefined(node.parameters);
19131
19133
  if (!(parameter && parameterIsThisKeyword(parameter))) {
19132
- return true;
19134
+ return !!(node.flags & 256 /* ContainsThis */);
19133
19135
  }
19134
19136
  }
19135
19137
  }
@@ -42683,6 +42685,7 @@ function createBinder() {
42683
42685
  const saveExceptionTarget = currentExceptionTarget;
42684
42686
  const saveActiveLabelList = activeLabelList;
42685
42687
  const saveHasExplicitReturn = hasExplicitReturn;
42688
+ const saveSeenThisKeyword = seenThisKeyword;
42686
42689
  const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 176 /* ClassStaticBlockDeclaration */;
42687
42690
  if (!isImmediatelyInvoked) {
42688
42691
  currentFlow = createFlowNode(
@@ -42702,13 +42705,17 @@ function createBinder() {
42702
42705
  currentContinueTarget = void 0;
42703
42706
  activeLabelList = void 0;
42704
42707
  hasExplicitReturn = false;
42708
+ seenThisKeyword = false;
42705
42709
  bindChildren(node);
42706
- node.flags &= ~5632 /* ReachabilityAndEmitFlags */;
42710
+ node.flags &= ~(5632 /* ReachabilityAndEmitFlags */ | 256 /* ContainsThis */);
42707
42711
  if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && nodeIsPresent(node.body)) {
42708
42712
  node.flags |= 512 /* HasImplicitReturn */;
42709
42713
  if (hasExplicitReturn) node.flags |= 1024 /* HasExplicitReturn */;
42710
42714
  node.endFlowNode = currentFlow;
42711
42715
  }
42716
+ if (seenThisKeyword) {
42717
+ node.flags |= 256 /* ContainsThis */;
42718
+ }
42712
42719
  if (node.kind === 308 /* SourceFile */) {
42713
42720
  node.flags |= emitFlags;
42714
42721
  node.endFlowNode = currentFlow;
@@ -42729,11 +42736,14 @@ function createBinder() {
42729
42736
  currentExceptionTarget = saveExceptionTarget;
42730
42737
  activeLabelList = saveActiveLabelList;
42731
42738
  hasExplicitReturn = saveHasExplicitReturn;
42739
+ seenThisKeyword = node.kind === 220 /* ArrowFunction */ ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
42732
42740
  } else if (containerFlags & 64 /* IsInterface */) {
42741
+ const saveSeenThisKeyword = seenThisKeyword;
42733
42742
  seenThisKeyword = false;
42734
42743
  bindChildren(node);
42735
42744
  Debug.assertNotNode(node, isIdentifier);
42736
42745
  node.flags = seenThisKeyword ? node.flags | 256 /* ContainsThis */ : node.flags & ~256 /* ContainsThis */;
42746
+ seenThisKeyword = saveSeenThisKeyword;
42737
42747
  } else {
42738
42748
  bindChildren(node);
42739
42749
  }
@@ -44213,6 +44223,9 @@ function createBinder() {
44213
44223
  }
44214
44224
  // falls through
44215
44225
  case 110 /* ThisKeyword */:
44226
+ if (node.kind === 110 /* ThisKeyword */) {
44227
+ seenThisKeyword = true;
44228
+ }
44216
44229
  if (currentFlow && (isExpression(node) || parent.kind === 305 /* ShorthandPropertyAssignment */)) {
44217
44230
  node.flowNode = currentFlow;
44218
44231
  }
@@ -45080,6 +45093,8 @@ function getContainerFlags(node) {
45080
45093
  // falls through
45081
45094
  case 177 /* Constructor */:
45082
45095
  case 263 /* FunctionDeclaration */:
45096
+ case 176 /* ClassStaticBlockDeclaration */:
45097
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45083
45098
  case 174 /* MethodSignature */:
45084
45099
  case 180 /* CallSignature */:
45085
45100
  case 324 /* JSDocSignature */:
@@ -45087,17 +45102,14 @@ function getContainerFlags(node) {
45087
45102
  case 185 /* FunctionType */:
45088
45103
  case 181 /* ConstructSignature */:
45089
45104
  case 186 /* ConstructorType */:
45090
- case 176 /* ClassStaticBlockDeclaration */:
45091
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45105
+ return 1 /* IsContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45092
45106
  case 352 /* JSDocImportTag */:
45093
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
45107
+ return 1 /* IsContainer */ | 32 /* HasLocals */;
45094
45108
  case 219 /* FunctionExpression */:
45095
45109
  case 220 /* ArrowFunction */:
45096
45110
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
45097
45111
  case 269 /* ModuleBlock */:
45098
45112
  return 4 /* IsControlFlowContainer */;
45099
- case 173 /* PropertyDeclaration */:
45100
- return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
45101
45113
  case 300 /* CatchClause */:
45102
45114
  case 249 /* ForStatement */:
45103
45115
  case 250 /* ForInStatement */:
@@ -63710,7 +63722,8 @@ function createTypeChecker(host) {
63710
63722
  const { initializer } = node;
63711
63723
  return !!initializer && isContextSensitive(initializer);
63712
63724
  }
63713
- case 295 /* JsxExpression */: {
63725
+ case 295 /* JsxExpression */:
63726
+ case 230 /* YieldExpression */: {
63714
63727
  const { expression } = node;
63715
63728
  return !!expression && isContextSensitive(expression);
63716
63729
  }
@@ -63718,7 +63731,7 @@ function createTypeChecker(host) {
63718
63731
  return false;
63719
63732
  }
63720
63733
  function isContextSensitiveFunctionLikeDeclaration(node) {
63721
- return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
63734
+ return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node) || hasContextSensitiveYieldExpression(node);
63722
63735
  }
63723
63736
  function hasContextSensitiveReturnExpression(node) {
63724
63737
  if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
@@ -63729,6 +63742,9 @@ function createTypeChecker(host) {
63729
63742
  }
63730
63743
  return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
63731
63744
  }
63745
+ function hasContextSensitiveYieldExpression(node) {
63746
+ return !!(getFunctionFlags(node) & 1 /* Generator */ && node.body && forEachYieldExpression(node.body, isContextSensitive));
63747
+ }
63732
63748
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
63733
63749
  return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
63734
63750
  }
@@ -73276,11 +73292,16 @@ function createTypeChecker(host) {
73276
73292
  if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
73277
73293
  const inferenceContext = getInferenceContext(node);
73278
73294
  if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
73279
- return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
73295
+ const type = instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
73296
+ if (!(type.flags & 3 /* AnyOrUnknown */)) {
73297
+ return type;
73298
+ }
73280
73299
  }
73281
73300
  if (inferenceContext == null ? void 0 : inferenceContext.returnMapper) {
73282
73301
  const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
73283
- return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type;
73302
+ if (!(type.flags & 3 /* AnyOrUnknown */)) {
73303
+ return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type;
73304
+ }
73284
73305
  }
73285
73306
  }
73286
73307
  return contextualType;
package/lib/typescript.js CHANGED
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
2286
2286
 
2287
2287
  // src/compiler/corePublic.ts
2288
2288
  var versionMajorMinor = "6.0";
2289
- var version = `${versionMajorMinor}.0-dev.20251210`;
2289
+ var version = `${versionMajorMinor}.0-dev.20251211`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -17972,12 +17972,15 @@ function forEachYieldExpression(body, visitor) {
17972
17972
  function traverse(node) {
17973
17973
  switch (node.kind) {
17974
17974
  case 230 /* YieldExpression */:
17975
- visitor(node);
17975
+ const value = visitor(node);
17976
+ if (value) {
17977
+ return value;
17978
+ }
17976
17979
  const operand = node.expression;
17977
- if (operand) {
17978
- traverse(operand);
17980
+ if (!operand) {
17981
+ return;
17979
17982
  }
17980
- return;
17983
+ return traverse(operand);
17981
17984
  case 267 /* EnumDeclaration */:
17982
17985
  case 265 /* InterfaceDeclaration */:
17983
17986
  case 268 /* ModuleDeclaration */:
@@ -17986,11 +17989,10 @@ function forEachYieldExpression(body, visitor) {
17986
17989
  default:
17987
17990
  if (isFunctionLike(node)) {
17988
17991
  if (node.name && node.name.kind === 168 /* ComputedPropertyName */) {
17989
- traverse(node.name.expression);
17990
- return;
17992
+ return traverse(node.name.expression);
17991
17993
  }
17992
17994
  } else if (!isPartOfTypeNode(node)) {
17993
- forEachChild(node, traverse);
17995
+ return forEachChild(node, traverse);
17994
17996
  }
17995
17997
  }
17996
17998
  }
@@ -23137,7 +23139,7 @@ function hasContextSensitiveParameters(node) {
23137
23139
  if (node.kind !== 220 /* ArrowFunction */) {
23138
23140
  const parameter = firstOrUndefined(node.parameters);
23139
23141
  if (!(parameter && parameterIsThisKeyword(parameter))) {
23140
- return true;
23142
+ return !!(node.flags & 256 /* ContainsThis */);
23141
23143
  }
23142
23144
  }
23143
23145
  }
@@ -47212,6 +47214,7 @@ function createBinder() {
47212
47214
  const saveExceptionTarget = currentExceptionTarget;
47213
47215
  const saveActiveLabelList = activeLabelList;
47214
47216
  const saveHasExplicitReturn = hasExplicitReturn;
47217
+ const saveSeenThisKeyword = seenThisKeyword;
47215
47218
  const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 176 /* ClassStaticBlockDeclaration */;
47216
47219
  if (!isImmediatelyInvoked) {
47217
47220
  currentFlow = createFlowNode(
@@ -47231,13 +47234,17 @@ function createBinder() {
47231
47234
  currentContinueTarget = void 0;
47232
47235
  activeLabelList = void 0;
47233
47236
  hasExplicitReturn = false;
47237
+ seenThisKeyword = false;
47234
47238
  bindChildren(node);
47235
- node.flags &= ~5632 /* ReachabilityAndEmitFlags */;
47239
+ node.flags &= ~(5632 /* ReachabilityAndEmitFlags */ | 256 /* ContainsThis */);
47236
47240
  if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && nodeIsPresent(node.body)) {
47237
47241
  node.flags |= 512 /* HasImplicitReturn */;
47238
47242
  if (hasExplicitReturn) node.flags |= 1024 /* HasExplicitReturn */;
47239
47243
  node.endFlowNode = currentFlow;
47240
47244
  }
47245
+ if (seenThisKeyword) {
47246
+ node.flags |= 256 /* ContainsThis */;
47247
+ }
47241
47248
  if (node.kind === 308 /* SourceFile */) {
47242
47249
  node.flags |= emitFlags;
47243
47250
  node.endFlowNode = currentFlow;
@@ -47258,11 +47265,14 @@ function createBinder() {
47258
47265
  currentExceptionTarget = saveExceptionTarget;
47259
47266
  activeLabelList = saveActiveLabelList;
47260
47267
  hasExplicitReturn = saveHasExplicitReturn;
47268
+ seenThisKeyword = node.kind === 220 /* ArrowFunction */ ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
47261
47269
  } else if (containerFlags & 64 /* IsInterface */) {
47270
+ const saveSeenThisKeyword = seenThisKeyword;
47262
47271
  seenThisKeyword = false;
47263
47272
  bindChildren(node);
47264
47273
  Debug.assertNotNode(node, isIdentifier);
47265
47274
  node.flags = seenThisKeyword ? node.flags | 256 /* ContainsThis */ : node.flags & ~256 /* ContainsThis */;
47275
+ seenThisKeyword = saveSeenThisKeyword;
47266
47276
  } else {
47267
47277
  bindChildren(node);
47268
47278
  }
@@ -48742,6 +48752,9 @@ function createBinder() {
48742
48752
  }
48743
48753
  // falls through
48744
48754
  case 110 /* ThisKeyword */:
48755
+ if (node.kind === 110 /* ThisKeyword */) {
48756
+ seenThisKeyword = true;
48757
+ }
48745
48758
  if (currentFlow && (isExpression(node) || parent2.kind === 305 /* ShorthandPropertyAssignment */)) {
48746
48759
  node.flowNode = currentFlow;
48747
48760
  }
@@ -49609,6 +49622,8 @@ function getContainerFlags(node) {
49609
49622
  // falls through
49610
49623
  case 177 /* Constructor */:
49611
49624
  case 263 /* FunctionDeclaration */:
49625
+ case 176 /* ClassStaticBlockDeclaration */:
49626
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
49612
49627
  case 174 /* MethodSignature */:
49613
49628
  case 180 /* CallSignature */:
49614
49629
  case 324 /* JSDocSignature */:
@@ -49616,17 +49631,14 @@ function getContainerFlags(node) {
49616
49631
  case 185 /* FunctionType */:
49617
49632
  case 181 /* ConstructSignature */:
49618
49633
  case 186 /* ConstructorType */:
49619
- case 176 /* ClassStaticBlockDeclaration */:
49620
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
49634
+ return 1 /* IsContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
49621
49635
  case 352 /* JSDocImportTag */:
49622
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
49636
+ return 1 /* IsContainer */ | 32 /* HasLocals */;
49623
49637
  case 219 /* FunctionExpression */:
49624
49638
  case 220 /* ArrowFunction */:
49625
49639
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
49626
49640
  case 269 /* ModuleBlock */:
49627
49641
  return 4 /* IsControlFlowContainer */;
49628
- case 173 /* PropertyDeclaration */:
49629
- return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
49630
49642
  case 300 /* CatchClause */:
49631
49643
  case 249 /* ForStatement */:
49632
49644
  case 250 /* ForInStatement */:
@@ -68339,7 +68351,8 @@ function createTypeChecker(host) {
68339
68351
  const { initializer } = node;
68340
68352
  return !!initializer && isContextSensitive(initializer);
68341
68353
  }
68342
- case 295 /* JsxExpression */: {
68354
+ case 295 /* JsxExpression */:
68355
+ case 230 /* YieldExpression */: {
68343
68356
  const { expression } = node;
68344
68357
  return !!expression && isContextSensitive(expression);
68345
68358
  }
@@ -68347,7 +68360,7 @@ function createTypeChecker(host) {
68347
68360
  return false;
68348
68361
  }
68349
68362
  function isContextSensitiveFunctionLikeDeclaration(node) {
68350
- return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
68363
+ return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node) || hasContextSensitiveYieldExpression(node);
68351
68364
  }
68352
68365
  function hasContextSensitiveReturnExpression(node) {
68353
68366
  if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
@@ -68358,6 +68371,9 @@ function createTypeChecker(host) {
68358
68371
  }
68359
68372
  return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression));
68360
68373
  }
68374
+ function hasContextSensitiveYieldExpression(node) {
68375
+ return !!(getFunctionFlags(node) & 1 /* Generator */ && node.body && forEachYieldExpression(node.body, isContextSensitive));
68376
+ }
68361
68377
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
68362
68378
  return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
68363
68379
  }
@@ -77905,11 +77921,16 @@ function createTypeChecker(host) {
77905
77921
  if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
77906
77922
  const inferenceContext = getInferenceContext(node);
77907
77923
  if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
77908
- return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
77924
+ const type = instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
77925
+ if (!(type.flags & 3 /* AnyOrUnknown */)) {
77926
+ return type;
77927
+ }
77909
77928
  }
77910
77929
  if (inferenceContext == null ? void 0 : inferenceContext.returnMapper) {
77911
77930
  const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
77912
- return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type;
77931
+ if (!(type.flags & 3 /* AnyOrUnknown */)) {
77932
+ return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type;
77933
+ }
77913
77934
  }
77914
77935
  }
77915
77936
  return contextualType;
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": "6.0.0-dev.20251210",
5
+ "version": "6.0.0-dev.20251211",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "1da8266179589bbc977ccbd8712614ed5ddd3004"
118
+ "gitHead": "366da34ae60b458e97c880fedf33298d6842ddd6"
119
119
  }