typescript 5.9.0-dev.20250313 → 5.9.0-dev.20250315

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 = "5.9";
21
- var version = `${versionMajorMinor}.0-dev.20250313`;
21
+ var version = `${versionMajorMinor}.0-dev.20250315`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -50406,10 +50406,11 @@ function createTypeChecker(host) {
50406
50406
  serializeExistingTypeNode(context, typeNode, addUndefined) {
50407
50407
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
50408
50408
  },
50409
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
50409
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
50410
50410
  const context = syntacticContext;
50411
50411
  const signature = getSignatureFromDeclaration(signatureDeclaration);
50412
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50412
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
50413
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50413
50414
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
50414
50415
  },
50415
50416
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -50423,7 +50424,7 @@ function createTypeChecker(host) {
50423
50424
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
50424
50425
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
50425
50426
  if (type === void 0) {
50426
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50427
+ type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50427
50428
  }
50428
50429
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
50429
50430
  if (addUndefinedForParameter) {
@@ -51572,12 +51573,13 @@ function createTypeChecker(host) {
51572
51573
  if (propertySymbol.flags & 98304 /* Accessor */) {
51573
51574
  const writeType = getWriteTypeOfSymbol(propertySymbol);
51574
51575
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
51576
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
51575
51577
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
51576
51578
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
51577
51579
  typeElements.push(
51578
51580
  setCommentRange2(
51579
51581
  context,
51580
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51582
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51581
51583
  getterDeclaration
51582
51584
  )
51583
51585
  );
@@ -51586,7 +51588,7 @@ function createTypeChecker(host) {
51586
51588
  typeElements.push(
51587
51589
  setCommentRange2(
51588
51590
  context,
51589
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51591
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51590
51592
  setterDeclaration
51591
51593
  )
51592
51594
  );
@@ -52729,13 +52731,13 @@ function createTypeChecker(host) {
52729
52731
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
52730
52732
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
52731
52733
  if (decl) {
52734
+ const restore = addSymbolTypeToContext(context, symbol, type);
52732
52735
  if (isAccessor(decl)) {
52733
52736
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
52734
52737
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
52735
- const restore = addSymbolTypeToContext(context, symbol, type);
52736
52738
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
52737
- restore();
52738
52739
  }
52740
+ restore();
52739
52741
  }
52740
52742
  if (!result) {
52741
52743
  if (addUndefinedForParameter) {
@@ -132217,12 +132219,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132217
132219
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
132218
132220
  }
132219
132221
  if (accessorDeclarations.getAccessor) {
132220
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
132221
- accessorDeclarations.getAccessor,
132222
- /*symbol*/
132223
- void 0,
132224
- context
132225
- ));
132222
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
132226
132223
  }
132227
132224
  return void 0;
132228
132225
  }
@@ -132332,14 +132329,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132332
132329
  }
132333
132330
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132334
132331
  }
132335
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
132332
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
132336
132333
  if (reportFallback) {
132337
132334
  context.tracker.reportInferenceFallback(node);
132338
132335
  }
132339
132336
  if (context.noInferenceFallback === true) {
132340
132337
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
132341
132338
  }
132342
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132339
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132343
132340
  }
132344
132341
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
132345
132342
  if (node.kind === 177 /* GetAccessor */) {
@@ -132774,7 +132771,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132774
132771
  } else if (isValueSignatureDeclaration(fn)) {
132775
132772
  returnType = typeFromSingleReturnExpression(fn, context);
132776
132773
  }
132777
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
132774
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
132778
132775
  }
132779
132776
  function typeFromSingleReturnExpression(declaration, context) {
132780
132777
  let candidateExpr;
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.20250313`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250315`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -55016,10 +55016,11 @@ function createTypeChecker(host) {
55016
55016
  serializeExistingTypeNode(context, typeNode, addUndefined) {
55017
55017
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
55018
55018
  },
55019
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
55019
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
55020
55020
  const context = syntacticContext;
55021
55021
  const signature = getSignatureFromDeclaration(signatureDeclaration);
55022
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55022
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
55023
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55023
55024
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
55024
55025
  },
55025
55026
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -55033,7 +55034,7 @@ function createTypeChecker(host) {
55033
55034
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
55034
55035
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
55035
55036
  if (type === void 0) {
55036
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
55037
+ type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
55037
55038
  }
55038
55039
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
55039
55040
  if (addUndefinedForParameter) {
@@ -56182,12 +56183,13 @@ function createTypeChecker(host) {
56182
56183
  if (propertySymbol.flags & 98304 /* Accessor */) {
56183
56184
  const writeType = getWriteTypeOfSymbol(propertySymbol);
56184
56185
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
56186
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
56185
56187
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
56186
56188
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
56187
56189
  typeElements.push(
56188
56190
  setCommentRange2(
56189
56191
  context,
56190
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56192
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56191
56193
  getterDeclaration
56192
56194
  )
56193
56195
  );
@@ -56196,7 +56198,7 @@ function createTypeChecker(host) {
56196
56198
  typeElements.push(
56197
56199
  setCommentRange2(
56198
56200
  context,
56199
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56201
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56200
56202
  setterDeclaration
56201
56203
  )
56202
56204
  );
@@ -57339,13 +57341,13 @@ function createTypeChecker(host) {
57339
57341
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
57340
57342
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
57341
57343
  if (decl) {
57344
+ const restore = addSymbolTypeToContext(context, symbol, type);
57342
57345
  if (isAccessor(decl)) {
57343
57346
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
57344
57347
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
57345
- const restore = addSymbolTypeToContext(context, symbol, type);
57346
57348
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
57347
- restore();
57348
57349
  }
57350
+ restore();
57349
57351
  }
57350
57352
  if (!result) {
57351
57353
  if (addUndefinedForParameter) {
@@ -137184,12 +137186,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137184
137186
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
137185
137187
  }
137186
137188
  if (accessorDeclarations.getAccessor) {
137187
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
137188
- accessorDeclarations.getAccessor,
137189
- /*symbol*/
137190
- void 0,
137191
- context
137192
- ));
137189
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
137193
137190
  }
137194
137191
  return void 0;
137195
137192
  }
@@ -137299,14 +137296,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137299
137296
  }
137300
137297
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137301
137298
  }
137302
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
137299
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
137303
137300
  if (reportFallback) {
137304
137301
  context.tracker.reportInferenceFallback(node);
137305
137302
  }
137306
137303
  if (context.noInferenceFallback === true) {
137307
137304
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
137308
137305
  }
137309
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137306
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137310
137307
  }
137311
137308
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
137312
137309
  if (node.kind === 177 /* GetAccessor */) {
@@ -137741,7 +137738,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137741
137738
  } else if (isValueSignatureDeclaration(fn)) {
137742
137739
  returnType = typeFromSingleReturnExpression(fn, context);
137743
137740
  }
137744
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
137741
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
137745
137742
  }
137746
137743
  function typeFromSingleReturnExpression(declaration, context) {
137747
137744
  let candidateExpr;
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.20250313",
5
+ "version": "5.9.0-dev.20250315",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "0aac72020ee8414218273f654eb7ce1dc2dd0d6b"
119
+ "gitHead": "a00b324ab2e9a303e8b2d94f3e0b2f3aa4975a5c"
120
120
  }