typescript 5.9.0-dev.20250219 → 5.9.0-dev.20250221

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.
Files changed (3) hide show
  1. package/lib/_tsc.js +19 -11
  2. package/lib/typescript.js +34 -11
  3. package/package.json +21 -21
package/lib/_tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.9";
21
- var version = `${versionMajorMinor}.0-dev.20250219`;
21
+ var version = `${versionMajorMinor}.0-dev.20250221`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -58572,7 +58572,7 @@ function createTypeChecker(host) {
58572
58572
  let hasThisParameter = false;
58573
58573
  const iife = getImmediatelyInvokedFunctionExpression(declaration);
58574
58574
  const isJSConstructSignature = isJSDocConstructSignature(declaration);
58575
- const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration);
58575
+ const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
58576
58576
  if (isUntypedSignatureInJSFile) {
58577
58577
  flags |= 32 /* IsUntypedSignatureInJSFile */;
58578
58578
  }
@@ -67513,7 +67513,7 @@ function createTypeChecker(host) {
67513
67513
  value,
67514
67514
  /*roundTripOnly*/
67515
67515
  false
67516
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67516
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
67517
67517
  }
67518
67518
  if (source.flags & 134217728 /* TemplateLiteral */) {
67519
67519
  const texts = source.texts;
@@ -77254,14 +77254,14 @@ function createTypeChecker(host) {
77254
77254
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
77255
77255
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
77256
77256
  }
77257
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
77257
+ function inferFromAnnotatedParametersAndReturn(signature, context, inferenceContext) {
77258
77258
  const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
77259
77259
  for (let i = 0; i < len; i++) {
77260
77260
  const declaration = signature.parameters[i].valueDeclaration;
77261
- const typeNode = getEffectiveTypeAnnotationNode(declaration);
77262
- if (typeNode) {
77261
+ const typeNode2 = getEffectiveTypeAnnotationNode(declaration);
77262
+ if (typeNode2) {
77263
77263
  const source = addOptionality(
77264
- getTypeFromTypeNode(typeNode),
77264
+ getTypeFromTypeNode(typeNode2),
77265
77265
  /*isProperty*/
77266
77266
  false,
77267
77267
  isOptionalDeclaration(declaration)
@@ -77270,6 +77270,12 @@ function createTypeChecker(host) {
77270
77270
  inferTypes(inferenceContext.inferences, source, target);
77271
77271
  }
77272
77272
  }
77273
+ const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
77274
+ if (typeNode) {
77275
+ const source = getTypeFromTypeNode(typeNode);
77276
+ const target = getReturnTypeOfSignature(context);
77277
+ inferTypes(inferenceContext.inferences, source, target);
77278
+ }
77273
77279
  }
77274
77280
  function assignContextualParameterTypes(signature, context) {
77275
77281
  if (context.typeParameters) {
@@ -77963,7 +77969,7 @@ function createTypeChecker(host) {
77963
77969
  const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
77964
77970
  if (trueType2 === initType) return void 0;
77965
77971
  const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent);
77966
- const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
77972
+ const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition));
77967
77973
  return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
77968
77974
  }
77969
77975
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
@@ -78058,7 +78064,7 @@ function createTypeChecker(host) {
78058
78064
  const inferenceContext = getInferenceContext(node);
78059
78065
  let instantiatedContextualSignature;
78060
78066
  if (checkMode && checkMode & 2 /* Inferential */) {
78061
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
78067
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
78062
78068
  const restType = getEffectiveRestType(contextualSignature);
78063
78069
  if (restType && restType.flags & 262144 /* TypeParameter */) {
78064
78070
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -78072,7 +78078,7 @@ function createTypeChecker(host) {
78072
78078
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
78073
78079
  const inferenceContext = getInferenceContext(node);
78074
78080
  if (checkMode && checkMode & 2 /* Inferential */) {
78075
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
78081
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
78076
78082
  }
78077
78083
  }
78078
78084
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -84568,7 +84574,7 @@ function createTypeChecker(host) {
84568
84574
  checkGrammarModifiers(node);
84569
84575
  checkCollisionsForDeclarationName(node, node.name);
84570
84576
  checkExportsOnMergedDeclarations(node);
84571
- node.members.forEach(checkEnumMember);
84577
+ node.members.forEach(checkSourceElement);
84572
84578
  if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
84573
84579
  error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
84574
84580
  }
@@ -85529,6 +85535,8 @@ function createTypeChecker(host) {
85529
85535
  return checkTypeAliasDeclaration(node);
85530
85536
  case 266 /* EnumDeclaration */:
85531
85537
  return checkEnumDeclaration(node);
85538
+ case 306 /* EnumMember */:
85539
+ return checkEnumMember(node);
85532
85540
  case 267 /* ModuleDeclaration */:
85533
85541
  return checkModuleDeclaration(node);
85534
85542
  case 272 /* ImportDeclaration */:
package/lib/typescript.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.9";
2288
- var version = `${versionMajorMinor}.0-dev.20250219`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250221`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -63182,7 +63182,7 @@ function createTypeChecker(host) {
63182
63182
  let hasThisParameter2 = false;
63183
63183
  const iife = getImmediatelyInvokedFunctionExpression(declaration);
63184
63184
  const isJSConstructSignature = isJSDocConstructSignature(declaration);
63185
- const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration);
63185
+ const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
63186
63186
  if (isUntypedSignatureInJSFile) {
63187
63187
  flags |= 32 /* IsUntypedSignatureInJSFile */;
63188
63188
  }
@@ -72123,7 +72123,7 @@ function createTypeChecker(host) {
72123
72123
  value,
72124
72124
  /*roundTripOnly*/
72125
72125
  false
72126
- ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
72126
+ ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
72127
72127
  }
72128
72128
  if (source.flags & 134217728 /* TemplateLiteral */) {
72129
72129
  const texts = source.texts;
@@ -81864,14 +81864,14 @@ function createTypeChecker(host) {
81864
81864
  function getTypeOfFirstParameterOfSignatureWithFallback(signature, fallbackType) {
81865
81865
  return signature.parameters.length > 0 ? getTypeAtPosition(signature, 0) : fallbackType;
81866
81866
  }
81867
- function inferFromAnnotatedParameters(signature, context, inferenceContext) {
81867
+ function inferFromAnnotatedParametersAndReturn(signature, context, inferenceContext) {
81868
81868
  const len = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
81869
81869
  for (let i = 0; i < len; i++) {
81870
81870
  const declaration = signature.parameters[i].valueDeclaration;
81871
- const typeNode = getEffectiveTypeAnnotationNode(declaration);
81872
- if (typeNode) {
81871
+ const typeNode2 = getEffectiveTypeAnnotationNode(declaration);
81872
+ if (typeNode2) {
81873
81873
  const source = addOptionality(
81874
- getTypeFromTypeNode(typeNode),
81874
+ getTypeFromTypeNode(typeNode2),
81875
81875
  /*isProperty*/
81876
81876
  false,
81877
81877
  isOptionalDeclaration(declaration)
@@ -81880,6 +81880,12 @@ function createTypeChecker(host) {
81880
81880
  inferTypes(inferenceContext.inferences, source, target);
81881
81881
  }
81882
81882
  }
81883
+ const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
81884
+ if (typeNode) {
81885
+ const source = getTypeFromTypeNode(typeNode);
81886
+ const target = getReturnTypeOfSignature(context);
81887
+ inferTypes(inferenceContext.inferences, source, target);
81888
+ }
81883
81889
  }
81884
81890
  function assignContextualParameterTypes(signature, context) {
81885
81891
  if (context.typeParameters) {
@@ -82573,7 +82579,7 @@ function createTypeChecker(host) {
82573
82579
  const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
82574
82580
  if (trueType2 === initType) return void 0;
82575
82581
  const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent);
82576
- const falseSubtype = getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition);
82582
+ const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition));
82577
82583
  return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
82578
82584
  }
82579
82585
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
@@ -82668,7 +82674,7 @@ function createTypeChecker(host) {
82668
82674
  const inferenceContext = getInferenceContext(node);
82669
82675
  let instantiatedContextualSignature;
82670
82676
  if (checkMode && checkMode & 2 /* Inferential */) {
82671
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82677
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
82672
82678
  const restType = getEffectiveRestType(contextualSignature);
82673
82679
  if (restType && restType.flags & 262144 /* TypeParameter */) {
82674
82680
  instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
@@ -82682,7 +82688,7 @@ function createTypeChecker(host) {
82682
82688
  } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) {
82683
82689
  const inferenceContext = getInferenceContext(node);
82684
82690
  if (checkMode && checkMode & 2 /* Inferential */) {
82685
- inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
82691
+ inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext);
82686
82692
  }
82687
82693
  }
82688
82694
  if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) {
@@ -89178,7 +89184,7 @@ function createTypeChecker(host) {
89178
89184
  checkGrammarModifiers(node);
89179
89185
  checkCollisionsForDeclarationName(node, node.name);
89180
89186
  checkExportsOnMergedDeclarations(node);
89181
- node.members.forEach(checkEnumMember);
89187
+ node.members.forEach(checkSourceElement);
89182
89188
  if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
89183
89189
  error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89184
89190
  }
@@ -90139,6 +90145,8 @@ function createTypeChecker(host) {
90139
90145
  return checkTypeAliasDeclaration(node);
90140
90146
  case 266 /* EnumDeclaration */:
90141
90147
  return checkEnumDeclaration(node);
90148
+ case 306 /* EnumMember */:
90149
+ return checkEnumMember(node);
90142
90150
  case 267 /* ModuleDeclaration */:
90143
90151
  return checkModuleDeclaration(node);
90144
90152
  case 272 /* ImportDeclaration */:
@@ -164390,10 +164398,14 @@ function typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget) {
164390
164398
  return getSynthesizedDeepClone(typeNode);
164391
164399
  }
164392
164400
  function endOfRequiredTypeParameters(checker, type) {
164401
+ var _a;
164393
164402
  Debug.assert(type.typeArguments);
164394
164403
  const fullTypeArguments = type.typeArguments;
164395
164404
  const target = type.target;
164396
164405
  for (let cutoff = 0; cutoff < fullTypeArguments.length; cutoff++) {
164406
+ if (((_a = target.localTypeParameters) == null ? void 0 : _a[cutoff].constraint) === void 0) {
164407
+ continue;
164408
+ }
164397
164409
  const typeArguments = fullTypeArguments.slice(0, cutoff);
164398
164410
  const filledIn = checker.fillMissingTypeArguments(
164399
164411
  typeArguments,
@@ -170103,6 +170115,17 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
170103
170115
  const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
170104
170116
  const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
170105
170117
  return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
170118
+ case 226 /* BinaryExpression */:
170119
+ if (parent2.operatorToken.kind === 103 /* InKeyword */) {
170120
+ const type = typeChecker.getTypeAtLocation(parent2.right);
170121
+ const properties = type.isUnion() ? typeChecker.getAllPossiblePropertiesOfTypes(type.types) : type.getApparentProperties();
170122
+ return {
170123
+ kind: 1 /* Properties */,
170124
+ symbols: properties.filter((prop) => !prop.valueDeclaration || !isPrivateIdentifierClassElementDeclaration(prop.valueDeclaration)),
170125
+ hasIndexSignature: false
170126
+ };
170127
+ }
170128
+ return fromContextualType(0 /* None */);
170106
170129
  default:
170107
170130
  return fromContextualType() || fromContextualType(0 /* None */);
170108
170131
  }
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.9.0-dev.20250219",
5
+ "version": "5.9.0-dev.20250221",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -40,48 +40,48 @@
40
40
  ],
41
41
  "devDependencies": {
42
42
  "@dprint/formatter": "^0.4.1",
43
- "@dprint/typescript": "0.93.3",
43
+ "@dprint/typescript": "0.93.4",
44
44
  "@esfx/canceltoken": "^1.0.0",
45
- "@eslint/js": "^9.17.0",
46
- "@octokit/rest": "^21.0.2",
45
+ "@eslint/js": "^9.20.0",
46
+ "@octokit/rest": "^21.1.1",
47
47
  "@types/chai": "^4.3.20",
48
- "@types/diff": "^5.2.3",
48
+ "@types/diff": "^7.0.1",
49
49
  "@types/minimist": "^1.2.5",
50
50
  "@types/mocha": "^10.0.10",
51
51
  "@types/ms": "^0.7.34",
52
52
  "@types/node": "latest",
53
53
  "@types/source-map-support": "^0.5.10",
54
54
  "@types/which": "^3.0.4",
55
- "@typescript-eslint/rule-tester": "^8.18.1",
56
- "@typescript-eslint/type-utils": "^8.18.1",
57
- "@typescript-eslint/utils": "^8.18.1",
55
+ "@typescript-eslint/rule-tester": "^8.24.1",
56
+ "@typescript-eslint/type-utils": "^8.24.1",
57
+ "@typescript-eslint/utils": "^8.24.1",
58
58
  "azure-devops-node-api": "^14.1.0",
59
59
  "c8": "^10.1.3",
60
60
  "chai": "^4.5.0",
61
- "chalk": "^4.1.2",
62
- "chokidar": "^3.6.0",
63
- "diff": "^5.2.0",
64
- "dprint": "^0.47.6",
61
+ "chokidar": "^4.0.3",
62
+ "diff": "^7.0.0",
63
+ "dprint": "^0.49.0",
65
64
  "esbuild": "^0.25.0",
66
- "eslint": "^9.17.0",
65
+ "eslint": "^9.20.1",
67
66
  "eslint-formatter-autolinkable-stylish": "^1.4.0",
68
67
  "eslint-plugin-regexp": "^2.7.0",
69
- "fast-xml-parser": "^4.5.1",
68
+ "fast-xml-parser": "^4.5.2",
70
69
  "glob": "^10.4.5",
71
- "globals": "^15.13.0",
70
+ "globals": "^15.15.0",
72
71
  "hereby": "^1.10.0",
73
72
  "jsonc-parser": "^3.3.1",
74
- "knip": "^5.41.0",
73
+ "knip": "^5.44.4",
75
74
  "minimist": "^1.2.8",
76
75
  "mocha": "^10.8.2",
77
76
  "mocha-fivemat-progress-reporter": "^0.1.0",
78
- "monocart-coverage-reports": "^2.11.4",
77
+ "monocart-coverage-reports": "^2.12.1",
79
78
  "ms": "^2.1.3",
80
- "playwright": "^1.49.1",
79
+ "picocolors": "^1.1.1",
80
+ "playwright": "^1.50.1",
81
81
  "source-map-support": "^0.5.21",
82
82
  "tslib": "^2.8.1",
83
- "typescript": "^5.7.2",
84
- "typescript-eslint": "^8.18.1",
83
+ "typescript": "^5.7.3",
84
+ "typescript-eslint": "^8.24.1",
85
85
  "which": "^3.0.1"
86
86
  },
87
87
  "overrides": {
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "246507f7f90e08a330fc9f63c1b11c2e706d9193"
119
+ "gitHead": "b95187d1ce2368a93a51b31c0cd11f5ba2557627"
120
120
  }