@typescript-deploys/pr-build 5.5.0-pr-57589-6 → 5.5.0-pr-55267-105

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
@@ -107841,17 +107841,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
107841
107841
  return getImportEntityNameVisibilityError;
107842
107842
  } else if (isTypeAliasDeclaration(node) || isJSDocTypeAlias(node)) {
107843
107843
  return getTypeAliasDeclarationVisibilityError;
107844
- } else if (isExportAssignment(node)) {
107845
- return getExportAssignmentTypeVisibilityDiagnosticMessage;
107846
107844
  } else {
107847
107845
  return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind(node.kind)}`);
107848
107846
  }
107849
- function getExportAssignmentTypeVisibilityDiagnosticMessage() {
107850
- return {
107851
- diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
107852
- errorNode: node
107853
- };
107854
- }
107855
107847
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
107856
107848
  if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) {
107857
107849
  return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
@@ -108097,7 +108089,6 @@ function transformDeclarations(context) {
108097
108089
  const resolver = context.getEmitResolver();
108098
108090
  const options = context.getCompilerOptions();
108099
108091
  const { noResolve, stripInternal } = options;
108100
- const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
108101
108092
  return transformRoot;
108102
108093
  function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
108103
108094
  if (!typeReferenceDirectives) {
@@ -108485,7 +108476,7 @@ function transformDeclarations(context) {
108485
108476
  );
108486
108477
  }
108487
108478
  }
108488
- function ensureParameter(p, modifierMask) {
108479
+ function ensureParameter(p, modifierMask, type) {
108489
108480
  let oldDiag;
108490
108481
  if (!suppressNewDiagnosticContexts) {
108491
108482
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -108499,6 +108490,7 @@ function transformDeclarations(context) {
108499
108490
  resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(58 /* QuestionToken */) : void 0,
108500
108491
  ensureType(
108501
108492
  p,
108493
+ type || p.type,
108502
108494
  /*ignorePrivate*/
108503
108495
  true
108504
108496
  ),
@@ -108519,37 +108511,18 @@ function transformDeclarations(context) {
108519
108511
  }
108520
108512
  return void 0;
108521
108513
  }
108522
- function ensureType(node, ignorePrivate) {
108514
+ function ensureType(node, type, ignorePrivate) {
108523
108515
  if (!ignorePrivate && hasEffectiveModifier(node, 2 /* Private */)) {
108524
108516
  return;
108525
108517
  }
108526
108518
  if (shouldPrintWithInitializer(node)) {
108527
108519
  return;
108528
108520
  }
108529
- return typeFromDeclaration(node);
108530
- }
108531
- function inferVariableLikeType(node, addUndefined) {
108532
- const flags = node.kind === 303 /* PropertyAssignment */ ? 4194304 /* InObjectTypeLiteral */ : 0 /* None */;
108533
- return resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags | flags, symbolTracker, addUndefined) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108534
- }
108535
- function inferExpressionType(node) {
108536
- return resolver.createTypeOfExpression(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108537
- }
108538
- function inferReturnTypeOfSignatureSignature(node) {
108539
- return resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108540
- }
108541
- function inferAccessorType(node) {
108542
- if (node.kind === 177 /* GetAccessor */) {
108543
- return inferReturnTypeOfSignatureSignature(node);
108544
- } else {
108545
- return factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108521
+ const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
108522
+ if (type && !shouldAddImplicitUndefined) {
108523
+ return visitNode(type, visitDeclarationSubtree, isTypeNode);
108546
108524
  }
108547
- }
108548
- function typeFromDeclaration(node) {
108549
- const savedErrorNameNode = errorNameNode;
108550
- const savedErrorFallbackNode = errorFallbackNode;
108551
108525
  errorNameNode = node.name;
108552
- errorFallbackNode = node;
108553
108526
  let oldDiag;
108554
108527
  if (!suppressNewDiagnosticContexts) {
108555
108528
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -108558,142 +108531,28 @@ function transformDeclarations(context) {
108558
108531
  let typeNode;
108559
108532
  switch (node.kind) {
108560
108533
  case 169 /* Parameter */:
108561
- typeNode = typeFromParameter(node);
108562
- break;
108563
- case 260 /* VariableDeclaration */:
108564
- typeNode = typeFromVariable(node);
108565
- break;
108534
+ case 171 /* PropertySignature */:
108566
108535
  case 172 /* PropertyDeclaration */:
108567
- typeNode = typeFromProperty(node);
108568
- break;
108569
- case 177 /* GetAccessor */:
108570
- typeNode = typeFromAccessor(node);
108571
- break;
108572
108536
  case 208 /* BindingElement */:
108573
- typeNode = inferVariableLikeType(node);
108537
+ case 260 /* VariableDeclaration */:
108538
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
108574
108539
  break;
108540
+ case 262 /* FunctionDeclaration */:
108575
108541
  case 180 /* ConstructSignature */:
108576
- case 171 /* PropertySignature */:
108577
108542
  case 173 /* MethodSignature */:
108578
- case 179 /* CallSignature */:
108579
- typeNode = visitTypeNode(node.type) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108580
- break;
108581
108543
  case 174 /* MethodDeclaration */:
108582
- case 262 /* FunctionDeclaration */:
108583
- typeNode = visitTypeNode(node.type) ?? inferReturnTypeOfSignatureSignature(node);
108584
- break;
108585
- case 277 /* ExportAssignment */:
108586
- typeNode = typeFromExpression(node.expression) ?? inferExpressionType(node.expression);
108544
+ case 177 /* GetAccessor */:
108545
+ case 179 /* CallSignature */:
108546
+ typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
108587
108547
  break;
108588
108548
  default:
108589
- Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
108549
+ Debug.assertNever(node);
108590
108550
  }
108591
- errorNameNode = savedErrorNameNode;
108592
- errorFallbackNode = savedErrorFallbackNode;
108551
+ errorNameNode = void 0;
108593
108552
  if (!suppressNewDiagnosticContexts) {
108594
108553
  getSymbolAccessibilityDiagnostic = oldDiag;
108595
108554
  }
108596
- return typeNode;
108597
- }
108598
- function visitTypeNode(type) {
108599
- return visitNode(type, visitDeclarationSubtree, isTypeNode);
108600
- }
108601
- function addUndefinedInUnion(type) {
108602
- if (!strictNullChecks)
108603
- return type;
108604
- if (isUnionTypeNode(type)) {
108605
- const hasUndefined = type.types.some((p) => p.kind === 157 /* UndefinedKeyword */);
108606
- if (hasUndefined)
108607
- return type;
108608
- return factory2.createUnionTypeNode([
108609
- ...type.types,
108610
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
108611
- ]);
108612
- }
108613
- return factory2.createUnionTypeNode([
108614
- type,
108615
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
108616
- ]);
108617
- }
108618
- function canAddUndefined(node) {
108619
- if (!strictNullChecks)
108620
- return true;
108621
- if (isKeyword(node.kind) || node.kind === 201 /* LiteralType */ || node.kind === 184 /* FunctionType */ || node.kind === 185 /* ConstructorType */ || node.kind === 188 /* ArrayType */ || node.kind === 189 /* TupleType */ || node.kind === 187 /* TypeLiteral */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 197 /* ThisType */) {
108622
- return true;
108623
- }
108624
- if (node.kind === 196 /* ParenthesizedType */) {
108625
- return canAddUndefined(node.type);
108626
- }
108627
- if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
108628
- return node.types.every(canAddUndefined);
108629
- }
108630
- return false;
108631
- }
108632
- function typeFromExpression(node, requiresUndefined) {
108633
- switch (node.kind) {
108634
- case 216 /* TypeAssertionExpression */:
108635
- case 234 /* AsExpression */:
108636
- const asExpression = node;
108637
- const type = asExpression.type;
108638
- if (isConstTypeReference(asExpression.type) || requiresUndefined && !canAddUndefined(type)) {
108639
- return void 0;
108640
- } else {
108641
- return visitTypeNode(type);
108642
- }
108643
- }
108644
- return void 0;
108645
- }
108646
- function typeFromAccessor(node) {
108647
- const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
108648
- const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
108649
- if (accessorType) {
108650
- return visitTypeNode(accessorType);
108651
- }
108652
- return inferAccessorType(accessorDeclarations.getAccessor ?? node);
108653
- }
108654
- function typeFromVariable(node) {
108655
- const declaredType = node.type;
108656
- if (declaredType) {
108657
- return visitNode(declaredType, visitDeclarationSubtree, isTypeNode);
108658
- }
108659
- let resultType;
108660
- if (node.initializer) {
108661
- resultType = typeFromExpression(node.initializer);
108662
- }
108663
- return resultType ?? inferVariableLikeType(node);
108664
- }
108665
- function typeFromParameter(node) {
108666
- const parent = node.parent;
108667
- if (parent.kind === 178 /* SetAccessor */) {
108668
- return typeFromAccessor(parent);
108669
- }
108670
- const declaredType = node.type;
108671
- const addUndefined = resolver.requiresAddingImplicitUndefined(node);
108672
- let resultType;
108673
- if (!addUndefined) {
108674
- if (declaredType) {
108675
- return visitTypeNode(declaredType);
108676
- }
108677
- if (node.initializer && isIdentifier(node.name)) {
108678
- resultType = typeFromExpression(node.initializer);
108679
- }
108680
- }
108681
- return resultType ?? inferVariableLikeType(node, addUndefined);
108682
- }
108683
- function typeFromProperty(node) {
108684
- const declaredType = node.type;
108685
- if (declaredType) {
108686
- return visitTypeNode(declaredType);
108687
- }
108688
- let resultType;
108689
- if (node.initializer) {
108690
- const isOptional = isOptionalDeclaration(node);
108691
- resultType = typeFromExpression(node.initializer, isOptional);
108692
- if (isOptional && resultType) {
108693
- return addUndefinedInUnion(resultType);
108694
- }
108695
- }
108696
- return resultType ?? inferVariableLikeType(node);
108555
+ return typeNode ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
108697
108556
  }
108698
108557
  function isDeclarationAndNotVisible(node) {
108699
108558
  node = getParseTreeNode(node);
@@ -108758,10 +108617,12 @@ function transformDeclarations(context) {
108758
108617
  if (!isPrivate) {
108759
108618
  const valueParameter = getSetAccessorValueParameter(input);
108760
108619
  if (valueParameter) {
108620
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
108761
108621
  newValueParameter = ensureParameter(
108762
108622
  valueParameter,
108763
108623
  /*modifierMask*/
108764
- void 0
108624
+ void 0,
108625
+ accessorType
108765
108626
  );
108766
108627
  }
108767
108628
  }
@@ -109008,7 +108869,7 @@ function transformDeclarations(context) {
109008
108869
  input,
109009
108870
  ensureTypeParams(input, input.typeParameters),
109010
108871
  updateParamsList(input, input.parameters),
109011
- ensureType(input)
108872
+ ensureType(input, input.type)
109012
108873
  ));
109013
108874
  case 176 /* Constructor */: {
109014
108875
  const ctor = factory2.createConstructorDeclaration(
@@ -109035,7 +108896,7 @@ function transformDeclarations(context) {
109035
108896
  input.questionToken,
109036
108897
  ensureTypeParams(input, input.typeParameters),
109037
108898
  updateParamsList(input, input.parameters),
109038
- ensureType(input),
108899
+ ensureType(input, input.type),
109039
108900
  /*body*/
109040
108901
  void 0
109041
108902
  );
@@ -109048,12 +108909,13 @@ function transformDeclarations(context) {
109048
108909
  void 0
109049
108910
  );
109050
108911
  }
108912
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
109051
108913
  return cleanup(factory2.updateGetAccessorDeclaration(
109052
108914
  input,
109053
108915
  ensureModifiers(input),
109054
108916
  input.name,
109055
108917
  updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
109056
- ensureType(input),
108918
+ ensureType(input, accessorType),
109057
108919
  /*body*/
109058
108920
  void 0
109059
108921
  ));
@@ -109086,7 +108948,7 @@ function transformDeclarations(context) {
109086
108948
  ensureModifiers(input),
109087
108949
  input.name,
109088
108950
  input.questionToken,
109089
- ensureType(input),
108951
+ ensureType(input, input.type),
109090
108952
  ensureNoInitializer(input)
109091
108953
  ));
109092
108954
  case 171 /* PropertySignature */:
@@ -109101,7 +108963,7 @@ function transformDeclarations(context) {
109101
108963
  ensureModifiers(input),
109102
108964
  input.name,
109103
108965
  input.questionToken,
109104
- ensureType(input)
108966
+ ensureType(input, input.type)
109105
108967
  ));
109106
108968
  case 173 /* MethodSignature */: {
109107
108969
  if (isPrivateIdentifier(input.name)) {
@@ -109117,7 +108979,7 @@ function transformDeclarations(context) {
109117
108979
  input.questionToken,
109118
108980
  ensureTypeParams(input, input.typeParameters),
109119
108981
  updateParamsList(input, input.parameters),
109120
- ensureType(input)
108982
+ ensureType(input, input.type)
109121
108983
  ));
109122
108984
  }
109123
108985
  case 179 /* CallSignature */: {
@@ -109126,7 +108988,7 @@ function transformDeclarations(context) {
109126
108988
  input,
109127
108989
  ensureTypeParams(input, input.typeParameters),
109128
108990
  updateParamsList(input, input.parameters),
109129
- ensureType(input)
108991
+ ensureType(input, input.type)
109130
108992
  )
109131
108993
  );
109132
108994
  }
@@ -109149,7 +109011,7 @@ function transformDeclarations(context) {
109149
109011
  input.name,
109150
109012
  /*exclamationToken*/
109151
109013
  void 0,
109152
- ensureType(input),
109014
+ ensureType(input, input.type),
109153
109015
  ensureNoInitializer(input)
109154
109016
  ));
109155
109017
  }
@@ -109277,12 +109139,11 @@ function transformDeclarations(context) {
109277
109139
  errorNode: input
109278
109140
  });
109279
109141
  errorFallbackNode = input;
109280
- const type = ensureType(input);
109281
109142
  const varDecl = factory2.createVariableDeclaration(
109282
109143
  newId,
109283
109144
  /*exclamationToken*/
109284
109145
  void 0,
109285
- type,
109146
+ resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
109286
109147
  /*initializer*/
109287
109148
  void 0
109288
109149
  );
@@ -109390,7 +109251,7 @@ function transformDeclarations(context) {
109390
109251
  input.name,
109391
109252
  ensureTypeParams(input, input.typeParameters),
109392
109253
  updateParamsList(input, input.parameters),
109393
- ensureType(input),
109254
+ ensureType(input, input.type),
109394
109255
  /*body*/
109395
109256
  void 0
109396
109257
  ));
@@ -109556,7 +109417,7 @@ function transformDeclarations(context) {
109556
109417
  ensureModifiers(param),
109557
109418
  param.name,
109558
109419
  param.questionToken,
109559
- ensureType(param),
109420
+ ensureType(param, param.type),
109560
109421
  ensureNoInitializer(param)
109561
109422
  ),
109562
109423
  param
@@ -109578,7 +109439,11 @@ function transformDeclarations(context) {
109578
109439
  elem.name,
109579
109440
  /*questionOrExclamationToken*/
109580
109441
  void 0,
109581
- ensureType(elem),
109442
+ ensureType(
109443
+ elem,
109444
+ /*type*/
109445
+ void 0
109446
+ ),
109582
109447
  /*initializer*/
109583
109448
  void 0
109584
109449
  ));
@@ -109727,7 +109592,11 @@ function transformDeclarations(context) {
109727
109592
  e.name,
109728
109593
  /*exclamationToken*/
109729
109594
  void 0,
109730
- ensureType(e),
109595
+ ensureType(
109596
+ e,
109597
+ /*type*/
109598
+ void 0
109599
+ ),
109731
109600
  /*initializer*/
109732
109601
  void 0
109733
109602
  );
package/lib/tsserver.js CHANGED
@@ -112747,17 +112747,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
112747
112747
  return getImportEntityNameVisibilityError;
112748
112748
  } else if (isTypeAliasDeclaration(node) || isJSDocTypeAlias(node)) {
112749
112749
  return getTypeAliasDeclarationVisibilityError;
112750
- } else if (isExportAssignment(node)) {
112751
- return getExportAssignmentTypeVisibilityDiagnosticMessage;
112752
112750
  } else {
112753
112751
  return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind(node.kind)}`);
112754
112752
  }
112755
- function getExportAssignmentTypeVisibilityDiagnosticMessage() {
112756
- return {
112757
- diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
112758
- errorNode: node
112759
- };
112760
- }
112761
112753
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
112762
112754
  if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) {
112763
112755
  return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
@@ -113003,7 +112995,6 @@ function transformDeclarations(context) {
113003
112995
  const resolver = context.getEmitResolver();
113004
112996
  const options = context.getCompilerOptions();
113005
112997
  const { noResolve, stripInternal } = options;
113006
- const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
113007
112998
  return transformRoot;
113008
112999
  function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
113009
113000
  if (!typeReferenceDirectives) {
@@ -113391,7 +113382,7 @@ function transformDeclarations(context) {
113391
113382
  );
113392
113383
  }
113393
113384
  }
113394
- function ensureParameter(p, modifierMask) {
113385
+ function ensureParameter(p, modifierMask, type) {
113395
113386
  let oldDiag;
113396
113387
  if (!suppressNewDiagnosticContexts) {
113397
113388
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -113405,6 +113396,7 @@ function transformDeclarations(context) {
113405
113396
  resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(58 /* QuestionToken */) : void 0,
113406
113397
  ensureType(
113407
113398
  p,
113399
+ type || p.type,
113408
113400
  /*ignorePrivate*/
113409
113401
  true
113410
113402
  ),
@@ -113425,37 +113417,18 @@ function transformDeclarations(context) {
113425
113417
  }
113426
113418
  return void 0;
113427
113419
  }
113428
- function ensureType(node, ignorePrivate) {
113420
+ function ensureType(node, type, ignorePrivate) {
113429
113421
  if (!ignorePrivate && hasEffectiveModifier(node, 2 /* Private */)) {
113430
113422
  return;
113431
113423
  }
113432
113424
  if (shouldPrintWithInitializer(node)) {
113433
113425
  return;
113434
113426
  }
113435
- return typeFromDeclaration(node);
113436
- }
113437
- function inferVariableLikeType(node, addUndefined) {
113438
- const flags = node.kind === 303 /* PropertyAssignment */ ? 4194304 /* InObjectTypeLiteral */ : 0 /* None */;
113439
- return resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags | flags, symbolTracker, addUndefined) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113440
- }
113441
- function inferExpressionType(node) {
113442
- return resolver.createTypeOfExpression(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113443
- }
113444
- function inferReturnTypeOfSignatureSignature(node) {
113445
- return resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113446
- }
113447
- function inferAccessorType(node) {
113448
- if (node.kind === 177 /* GetAccessor */) {
113449
- return inferReturnTypeOfSignatureSignature(node);
113450
- } else {
113451
- return factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113427
+ const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
113428
+ if (type && !shouldAddImplicitUndefined) {
113429
+ return visitNode(type, visitDeclarationSubtree, isTypeNode);
113452
113430
  }
113453
- }
113454
- function typeFromDeclaration(node) {
113455
- const savedErrorNameNode = errorNameNode;
113456
- const savedErrorFallbackNode = errorFallbackNode;
113457
113431
  errorNameNode = node.name;
113458
- errorFallbackNode = node;
113459
113432
  let oldDiag;
113460
113433
  if (!suppressNewDiagnosticContexts) {
113461
113434
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -113464,142 +113437,28 @@ function transformDeclarations(context) {
113464
113437
  let typeNode;
113465
113438
  switch (node.kind) {
113466
113439
  case 169 /* Parameter */:
113467
- typeNode = typeFromParameter(node);
113468
- break;
113469
- case 260 /* VariableDeclaration */:
113470
- typeNode = typeFromVariable(node);
113471
- break;
113440
+ case 171 /* PropertySignature */:
113472
113441
  case 172 /* PropertyDeclaration */:
113473
- typeNode = typeFromProperty(node);
113474
- break;
113475
- case 177 /* GetAccessor */:
113476
- typeNode = typeFromAccessor(node);
113477
- break;
113478
113442
  case 208 /* BindingElement */:
113479
- typeNode = inferVariableLikeType(node);
113443
+ case 260 /* VariableDeclaration */:
113444
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
113480
113445
  break;
113446
+ case 262 /* FunctionDeclaration */:
113481
113447
  case 180 /* ConstructSignature */:
113482
- case 171 /* PropertySignature */:
113483
113448
  case 173 /* MethodSignature */:
113484
- case 179 /* CallSignature */:
113485
- typeNode = visitTypeNode(node.type) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113486
- break;
113487
113449
  case 174 /* MethodDeclaration */:
113488
- case 262 /* FunctionDeclaration */:
113489
- typeNode = visitTypeNode(node.type) ?? inferReturnTypeOfSignatureSignature(node);
113490
- break;
113491
- case 277 /* ExportAssignment */:
113492
- typeNode = typeFromExpression(node.expression) ?? inferExpressionType(node.expression);
113450
+ case 177 /* GetAccessor */:
113451
+ case 179 /* CallSignature */:
113452
+ typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
113493
113453
  break;
113494
113454
  default:
113495
- Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
113455
+ Debug.assertNever(node);
113496
113456
  }
113497
- errorNameNode = savedErrorNameNode;
113498
- errorFallbackNode = savedErrorFallbackNode;
113457
+ errorNameNode = void 0;
113499
113458
  if (!suppressNewDiagnosticContexts) {
113500
113459
  getSymbolAccessibilityDiagnostic = oldDiag;
113501
113460
  }
113502
- return typeNode;
113503
- }
113504
- function visitTypeNode(type) {
113505
- return visitNode(type, visitDeclarationSubtree, isTypeNode);
113506
- }
113507
- function addUndefinedInUnion(type) {
113508
- if (!strictNullChecks)
113509
- return type;
113510
- if (isUnionTypeNode(type)) {
113511
- const hasUndefined = type.types.some((p) => p.kind === 157 /* UndefinedKeyword */);
113512
- if (hasUndefined)
113513
- return type;
113514
- return factory2.createUnionTypeNode([
113515
- ...type.types,
113516
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
113517
- ]);
113518
- }
113519
- return factory2.createUnionTypeNode([
113520
- type,
113521
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
113522
- ]);
113523
- }
113524
- function canAddUndefined(node) {
113525
- if (!strictNullChecks)
113526
- return true;
113527
- if (isKeyword(node.kind) || node.kind === 201 /* LiteralType */ || node.kind === 184 /* FunctionType */ || node.kind === 185 /* ConstructorType */ || node.kind === 188 /* ArrayType */ || node.kind === 189 /* TupleType */ || node.kind === 187 /* TypeLiteral */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 197 /* ThisType */) {
113528
- return true;
113529
- }
113530
- if (node.kind === 196 /* ParenthesizedType */) {
113531
- return canAddUndefined(node.type);
113532
- }
113533
- if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
113534
- return node.types.every(canAddUndefined);
113535
- }
113536
- return false;
113537
- }
113538
- function typeFromExpression(node, requiresUndefined) {
113539
- switch (node.kind) {
113540
- case 216 /* TypeAssertionExpression */:
113541
- case 234 /* AsExpression */:
113542
- const asExpression = node;
113543
- const type = asExpression.type;
113544
- if (isConstTypeReference(asExpression.type) || requiresUndefined && !canAddUndefined(type)) {
113545
- return void 0;
113546
- } else {
113547
- return visitTypeNode(type);
113548
- }
113549
- }
113550
- return void 0;
113551
- }
113552
- function typeFromAccessor(node) {
113553
- const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
113554
- const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
113555
- if (accessorType) {
113556
- return visitTypeNode(accessorType);
113557
- }
113558
- return inferAccessorType(accessorDeclarations.getAccessor ?? node);
113559
- }
113560
- function typeFromVariable(node) {
113561
- const declaredType = node.type;
113562
- if (declaredType) {
113563
- return visitNode(declaredType, visitDeclarationSubtree, isTypeNode);
113564
- }
113565
- let resultType;
113566
- if (node.initializer) {
113567
- resultType = typeFromExpression(node.initializer);
113568
- }
113569
- return resultType ?? inferVariableLikeType(node);
113570
- }
113571
- function typeFromParameter(node) {
113572
- const parent2 = node.parent;
113573
- if (parent2.kind === 178 /* SetAccessor */) {
113574
- return typeFromAccessor(parent2);
113575
- }
113576
- const declaredType = node.type;
113577
- const addUndefined = resolver.requiresAddingImplicitUndefined(node);
113578
- let resultType;
113579
- if (!addUndefined) {
113580
- if (declaredType) {
113581
- return visitTypeNode(declaredType);
113582
- }
113583
- if (node.initializer && isIdentifier(node.name)) {
113584
- resultType = typeFromExpression(node.initializer);
113585
- }
113586
- }
113587
- return resultType ?? inferVariableLikeType(node, addUndefined);
113588
- }
113589
- function typeFromProperty(node) {
113590
- const declaredType = node.type;
113591
- if (declaredType) {
113592
- return visitTypeNode(declaredType);
113593
- }
113594
- let resultType;
113595
- if (node.initializer) {
113596
- const isOptional = isOptionalDeclaration(node);
113597
- resultType = typeFromExpression(node.initializer, isOptional);
113598
- if (isOptional && resultType) {
113599
- return addUndefinedInUnion(resultType);
113600
- }
113601
- }
113602
- return resultType ?? inferVariableLikeType(node);
113461
+ return typeNode ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113603
113462
  }
113604
113463
  function isDeclarationAndNotVisible(node) {
113605
113464
  node = getParseTreeNode(node);
@@ -113664,10 +113523,12 @@ function transformDeclarations(context) {
113664
113523
  if (!isPrivate) {
113665
113524
  const valueParameter = getSetAccessorValueParameter(input);
113666
113525
  if (valueParameter) {
113526
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
113667
113527
  newValueParameter = ensureParameter(
113668
113528
  valueParameter,
113669
113529
  /*modifierMask*/
113670
- void 0
113530
+ void 0,
113531
+ accessorType
113671
113532
  );
113672
113533
  }
113673
113534
  }
@@ -113914,7 +113775,7 @@ function transformDeclarations(context) {
113914
113775
  input,
113915
113776
  ensureTypeParams(input, input.typeParameters),
113916
113777
  updateParamsList(input, input.parameters),
113917
- ensureType(input)
113778
+ ensureType(input, input.type)
113918
113779
  ));
113919
113780
  case 176 /* Constructor */: {
113920
113781
  const ctor = factory2.createConstructorDeclaration(
@@ -113941,7 +113802,7 @@ function transformDeclarations(context) {
113941
113802
  input.questionToken,
113942
113803
  ensureTypeParams(input, input.typeParameters),
113943
113804
  updateParamsList(input, input.parameters),
113944
- ensureType(input),
113805
+ ensureType(input, input.type),
113945
113806
  /*body*/
113946
113807
  void 0
113947
113808
  );
@@ -113954,12 +113815,13 @@ function transformDeclarations(context) {
113954
113815
  void 0
113955
113816
  );
113956
113817
  }
113818
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
113957
113819
  return cleanup(factory2.updateGetAccessorDeclaration(
113958
113820
  input,
113959
113821
  ensureModifiers(input),
113960
113822
  input.name,
113961
113823
  updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
113962
- ensureType(input),
113824
+ ensureType(input, accessorType),
113963
113825
  /*body*/
113964
113826
  void 0
113965
113827
  ));
@@ -113992,7 +113854,7 @@ function transformDeclarations(context) {
113992
113854
  ensureModifiers(input),
113993
113855
  input.name,
113994
113856
  input.questionToken,
113995
- ensureType(input),
113857
+ ensureType(input, input.type),
113996
113858
  ensureNoInitializer(input)
113997
113859
  ));
113998
113860
  case 171 /* PropertySignature */:
@@ -114007,7 +113869,7 @@ function transformDeclarations(context) {
114007
113869
  ensureModifiers(input),
114008
113870
  input.name,
114009
113871
  input.questionToken,
114010
- ensureType(input)
113872
+ ensureType(input, input.type)
114011
113873
  ));
114012
113874
  case 173 /* MethodSignature */: {
114013
113875
  if (isPrivateIdentifier(input.name)) {
@@ -114023,7 +113885,7 @@ function transformDeclarations(context) {
114023
113885
  input.questionToken,
114024
113886
  ensureTypeParams(input, input.typeParameters),
114025
113887
  updateParamsList(input, input.parameters),
114026
- ensureType(input)
113888
+ ensureType(input, input.type)
114027
113889
  ));
114028
113890
  }
114029
113891
  case 179 /* CallSignature */: {
@@ -114032,7 +113894,7 @@ function transformDeclarations(context) {
114032
113894
  input,
114033
113895
  ensureTypeParams(input, input.typeParameters),
114034
113896
  updateParamsList(input, input.parameters),
114035
- ensureType(input)
113897
+ ensureType(input, input.type)
114036
113898
  )
114037
113899
  );
114038
113900
  }
@@ -114055,7 +113917,7 @@ function transformDeclarations(context) {
114055
113917
  input.name,
114056
113918
  /*exclamationToken*/
114057
113919
  void 0,
114058
- ensureType(input),
113920
+ ensureType(input, input.type),
114059
113921
  ensureNoInitializer(input)
114060
113922
  ));
114061
113923
  }
@@ -114183,12 +114045,11 @@ function transformDeclarations(context) {
114183
114045
  errorNode: input
114184
114046
  });
114185
114047
  errorFallbackNode = input;
114186
- const type = ensureType(input);
114187
114048
  const varDecl = factory2.createVariableDeclaration(
114188
114049
  newId,
114189
114050
  /*exclamationToken*/
114190
114051
  void 0,
114191
- type,
114052
+ resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
114192
114053
  /*initializer*/
114193
114054
  void 0
114194
114055
  );
@@ -114296,7 +114157,7 @@ function transformDeclarations(context) {
114296
114157
  input.name,
114297
114158
  ensureTypeParams(input, input.typeParameters),
114298
114159
  updateParamsList(input, input.parameters),
114299
- ensureType(input),
114160
+ ensureType(input, input.type),
114300
114161
  /*body*/
114301
114162
  void 0
114302
114163
  ));
@@ -114462,7 +114323,7 @@ function transformDeclarations(context) {
114462
114323
  ensureModifiers(param),
114463
114324
  param.name,
114464
114325
  param.questionToken,
114465
- ensureType(param),
114326
+ ensureType(param, param.type),
114466
114327
  ensureNoInitializer(param)
114467
114328
  ),
114468
114329
  param
@@ -114484,7 +114345,11 @@ function transformDeclarations(context) {
114484
114345
  elem.name,
114485
114346
  /*questionOrExclamationToken*/
114486
114347
  void 0,
114487
- ensureType(elem),
114348
+ ensureType(
114349
+ elem,
114350
+ /*type*/
114351
+ void 0
114352
+ ),
114488
114353
  /*initializer*/
114489
114354
  void 0
114490
114355
  ));
@@ -114633,7 +114498,11 @@ function transformDeclarations(context) {
114633
114498
  e.name,
114634
114499
  /*exclamationToken*/
114635
114500
  void 0,
114636
- ensureType(e),
114501
+ ensureType(
114502
+ e,
114503
+ /*type*/
114504
+ void 0
114505
+ ),
114637
114506
  /*initializer*/
114638
114507
  void 0
114639
114508
  );
package/lib/typescript.js CHANGED
@@ -112747,17 +112747,9 @@ function createGetSymbolAccessibilityDiagnosticForNode(node) {
112747
112747
  return getImportEntityNameVisibilityError;
112748
112748
  } else if (isTypeAliasDeclaration(node) || isJSDocTypeAlias(node)) {
112749
112749
  return getTypeAliasDeclarationVisibilityError;
112750
- } else if (isExportAssignment(node)) {
112751
- return getExportAssignmentTypeVisibilityDiagnosticMessage;
112752
112750
  } else {
112753
112751
  return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind(node.kind)}`);
112754
112752
  }
112755
- function getExportAssignmentTypeVisibilityDiagnosticMessage() {
112756
- return {
112757
- diagnosticMessage: Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,
112758
- errorNode: node
112759
- };
112760
- }
112761
112753
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
112762
112754
  if (node.kind === 260 /* VariableDeclaration */ || node.kind === 208 /* BindingElement */) {
112763
112755
  return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
@@ -113003,7 +112995,6 @@ function transformDeclarations(context) {
113003
112995
  const resolver = context.getEmitResolver();
113004
112996
  const options = context.getCompilerOptions();
113005
112997
  const { noResolve, stripInternal } = options;
113006
- const strictNullChecks = getStrictOptionValue(options, "strictNullChecks");
113007
112998
  return transformRoot;
113008
112999
  function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
113009
113000
  if (!typeReferenceDirectives) {
@@ -113391,7 +113382,7 @@ function transformDeclarations(context) {
113391
113382
  );
113392
113383
  }
113393
113384
  }
113394
- function ensureParameter(p, modifierMask) {
113385
+ function ensureParameter(p, modifierMask, type) {
113395
113386
  let oldDiag;
113396
113387
  if (!suppressNewDiagnosticContexts) {
113397
113388
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -113405,6 +113396,7 @@ function transformDeclarations(context) {
113405
113396
  resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(58 /* QuestionToken */) : void 0,
113406
113397
  ensureType(
113407
113398
  p,
113399
+ type || p.type,
113408
113400
  /*ignorePrivate*/
113409
113401
  true
113410
113402
  ),
@@ -113425,37 +113417,18 @@ function transformDeclarations(context) {
113425
113417
  }
113426
113418
  return void 0;
113427
113419
  }
113428
- function ensureType(node, ignorePrivate) {
113420
+ function ensureType(node, type, ignorePrivate) {
113429
113421
  if (!ignorePrivate && hasEffectiveModifier(node, 2 /* Private */)) {
113430
113422
  return;
113431
113423
  }
113432
113424
  if (shouldPrintWithInitializer(node)) {
113433
113425
  return;
113434
113426
  }
113435
- return typeFromDeclaration(node);
113436
- }
113437
- function inferVariableLikeType(node, addUndefined) {
113438
- const flags = node.kind === 303 /* PropertyAssignment */ ? 4194304 /* InObjectTypeLiteral */ : 0 /* None */;
113439
- return resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags | flags, symbolTracker, addUndefined) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113440
- }
113441
- function inferExpressionType(node) {
113442
- return resolver.createTypeOfExpression(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113443
- }
113444
- function inferReturnTypeOfSignatureSignature(node) {
113445
- return resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113446
- }
113447
- function inferAccessorType(node) {
113448
- if (node.kind === 177 /* GetAccessor */) {
113449
- return inferReturnTypeOfSignatureSignature(node);
113450
- } else {
113451
- return factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113427
+ const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
113428
+ if (type && !shouldAddImplicitUndefined) {
113429
+ return visitNode(type, visitDeclarationSubtree, isTypeNode);
113452
113430
  }
113453
- }
113454
- function typeFromDeclaration(node) {
113455
- const savedErrorNameNode = errorNameNode;
113456
- const savedErrorFallbackNode = errorFallbackNode;
113457
113431
  errorNameNode = node.name;
113458
- errorFallbackNode = node;
113459
113432
  let oldDiag;
113460
113433
  if (!suppressNewDiagnosticContexts) {
113461
113434
  oldDiag = getSymbolAccessibilityDiagnostic;
@@ -113464,142 +113437,28 @@ function transformDeclarations(context) {
113464
113437
  let typeNode;
113465
113438
  switch (node.kind) {
113466
113439
  case 169 /* Parameter */:
113467
- typeNode = typeFromParameter(node);
113468
- break;
113469
- case 260 /* VariableDeclaration */:
113470
- typeNode = typeFromVariable(node);
113471
- break;
113440
+ case 171 /* PropertySignature */:
113472
113441
  case 172 /* PropertyDeclaration */:
113473
- typeNode = typeFromProperty(node);
113474
- break;
113475
- case 177 /* GetAccessor */:
113476
- typeNode = typeFromAccessor(node);
113477
- break;
113478
113442
  case 208 /* BindingElement */:
113479
- typeNode = inferVariableLikeType(node);
113443
+ case 260 /* VariableDeclaration */:
113444
+ typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
113480
113445
  break;
113446
+ case 262 /* FunctionDeclaration */:
113481
113447
  case 180 /* ConstructSignature */:
113482
- case 171 /* PropertySignature */:
113483
113448
  case 173 /* MethodSignature */:
113484
- case 179 /* CallSignature */:
113485
- typeNode = visitTypeNode(node.type) ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113486
- break;
113487
113449
  case 174 /* MethodDeclaration */:
113488
- case 262 /* FunctionDeclaration */:
113489
- typeNode = visitTypeNode(node.type) ?? inferReturnTypeOfSignatureSignature(node);
113490
- break;
113491
- case 277 /* ExportAssignment */:
113492
- typeNode = typeFromExpression(node.expression) ?? inferExpressionType(node.expression);
113450
+ case 177 /* GetAccessor */:
113451
+ case 179 /* CallSignature */:
113452
+ typeNode = resolver.createReturnTypeOfSignatureDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
113493
113453
  break;
113494
113454
  default:
113495
- Debug.assertNever(node, `Node needs to be an inferrable node, found ${Debug.formatSyntaxKind(node.kind)}`);
113455
+ Debug.assertNever(node);
113496
113456
  }
113497
- errorNameNode = savedErrorNameNode;
113498
- errorFallbackNode = savedErrorFallbackNode;
113457
+ errorNameNode = void 0;
113499
113458
  if (!suppressNewDiagnosticContexts) {
113500
113459
  getSymbolAccessibilityDiagnostic = oldDiag;
113501
113460
  }
113502
- return typeNode;
113503
- }
113504
- function visitTypeNode(type) {
113505
- return visitNode(type, visitDeclarationSubtree, isTypeNode);
113506
- }
113507
- function addUndefinedInUnion(type) {
113508
- if (!strictNullChecks)
113509
- return type;
113510
- if (isUnionTypeNode(type)) {
113511
- const hasUndefined = type.types.some((p) => p.kind === 157 /* UndefinedKeyword */);
113512
- if (hasUndefined)
113513
- return type;
113514
- return factory2.createUnionTypeNode([
113515
- ...type.types,
113516
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
113517
- ]);
113518
- }
113519
- return factory2.createUnionTypeNode([
113520
- type,
113521
- factory2.createKeywordTypeNode(157 /* UndefinedKeyword */)
113522
- ]);
113523
- }
113524
- function canAddUndefined(node) {
113525
- if (!strictNullChecks)
113526
- return true;
113527
- if (isKeyword(node.kind) || node.kind === 201 /* LiteralType */ || node.kind === 184 /* FunctionType */ || node.kind === 185 /* ConstructorType */ || node.kind === 188 /* ArrayType */ || node.kind === 189 /* TupleType */ || node.kind === 187 /* TypeLiteral */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 197 /* ThisType */) {
113528
- return true;
113529
- }
113530
- if (node.kind === 196 /* ParenthesizedType */) {
113531
- return canAddUndefined(node.type);
113532
- }
113533
- if (node.kind === 192 /* UnionType */ || node.kind === 193 /* IntersectionType */) {
113534
- return node.types.every(canAddUndefined);
113535
- }
113536
- return false;
113537
- }
113538
- function typeFromExpression(node, requiresUndefined) {
113539
- switch (node.kind) {
113540
- case 216 /* TypeAssertionExpression */:
113541
- case 234 /* AsExpression */:
113542
- const asExpression = node;
113543
- const type = asExpression.type;
113544
- if (isConstTypeReference(asExpression.type) || requiresUndefined && !canAddUndefined(type)) {
113545
- return void 0;
113546
- } else {
113547
- return visitTypeNode(type);
113548
- }
113549
- }
113550
- return void 0;
113551
- }
113552
- function typeFromAccessor(node) {
113553
- const accessorDeclarations = resolver.getAllAccessorDeclarations(node);
113554
- const accessorType = getTypeAnnotationFromAllAccessorDeclarations(node, accessorDeclarations);
113555
- if (accessorType) {
113556
- return visitTypeNode(accessorType);
113557
- }
113558
- return inferAccessorType(accessorDeclarations.getAccessor ?? node);
113559
- }
113560
- function typeFromVariable(node) {
113561
- const declaredType = node.type;
113562
- if (declaredType) {
113563
- return visitNode(declaredType, visitDeclarationSubtree, isTypeNode);
113564
- }
113565
- let resultType;
113566
- if (node.initializer) {
113567
- resultType = typeFromExpression(node.initializer);
113568
- }
113569
- return resultType ?? inferVariableLikeType(node);
113570
- }
113571
- function typeFromParameter(node) {
113572
- const parent2 = node.parent;
113573
- if (parent2.kind === 178 /* SetAccessor */) {
113574
- return typeFromAccessor(parent2);
113575
- }
113576
- const declaredType = node.type;
113577
- const addUndefined = resolver.requiresAddingImplicitUndefined(node);
113578
- let resultType;
113579
- if (!addUndefined) {
113580
- if (declaredType) {
113581
- return visitTypeNode(declaredType);
113582
- }
113583
- if (node.initializer && isIdentifier(node.name)) {
113584
- resultType = typeFromExpression(node.initializer);
113585
- }
113586
- }
113587
- return resultType ?? inferVariableLikeType(node, addUndefined);
113588
- }
113589
- function typeFromProperty(node) {
113590
- const declaredType = node.type;
113591
- if (declaredType) {
113592
- return visitTypeNode(declaredType);
113593
- }
113594
- let resultType;
113595
- if (node.initializer) {
113596
- const isOptional = isOptionalDeclaration(node);
113597
- resultType = typeFromExpression(node.initializer, isOptional);
113598
- if (isOptional && resultType) {
113599
- return addUndefinedInUnion(resultType);
113600
- }
113601
- }
113602
- return resultType ?? inferVariableLikeType(node);
113461
+ return typeNode ?? factory2.createKeywordTypeNode(133 /* AnyKeyword */);
113603
113462
  }
113604
113463
  function isDeclarationAndNotVisible(node) {
113605
113464
  node = getParseTreeNode(node);
@@ -113664,10 +113523,12 @@ function transformDeclarations(context) {
113664
113523
  if (!isPrivate) {
113665
113524
  const valueParameter = getSetAccessorValueParameter(input);
113666
113525
  if (valueParameter) {
113526
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
113667
113527
  newValueParameter = ensureParameter(
113668
113528
  valueParameter,
113669
113529
  /*modifierMask*/
113670
- void 0
113530
+ void 0,
113531
+ accessorType
113671
113532
  );
113672
113533
  }
113673
113534
  }
@@ -113914,7 +113775,7 @@ function transformDeclarations(context) {
113914
113775
  input,
113915
113776
  ensureTypeParams(input, input.typeParameters),
113916
113777
  updateParamsList(input, input.parameters),
113917
- ensureType(input)
113778
+ ensureType(input, input.type)
113918
113779
  ));
113919
113780
  case 176 /* Constructor */: {
113920
113781
  const ctor = factory2.createConstructorDeclaration(
@@ -113941,7 +113802,7 @@ function transformDeclarations(context) {
113941
113802
  input.questionToken,
113942
113803
  ensureTypeParams(input, input.typeParameters),
113943
113804
  updateParamsList(input, input.parameters),
113944
- ensureType(input),
113805
+ ensureType(input, input.type),
113945
113806
  /*body*/
113946
113807
  void 0
113947
113808
  );
@@ -113954,12 +113815,13 @@ function transformDeclarations(context) {
113954
113815
  void 0
113955
113816
  );
113956
113817
  }
113818
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
113957
113819
  return cleanup(factory2.updateGetAccessorDeclaration(
113958
113820
  input,
113959
113821
  ensureModifiers(input),
113960
113822
  input.name,
113961
113823
  updateAccessorParamsList(input, hasEffectiveModifier(input, 2 /* Private */)),
113962
- ensureType(input),
113824
+ ensureType(input, accessorType),
113963
113825
  /*body*/
113964
113826
  void 0
113965
113827
  ));
@@ -113992,7 +113854,7 @@ function transformDeclarations(context) {
113992
113854
  ensureModifiers(input),
113993
113855
  input.name,
113994
113856
  input.questionToken,
113995
- ensureType(input),
113857
+ ensureType(input, input.type),
113996
113858
  ensureNoInitializer(input)
113997
113859
  ));
113998
113860
  case 171 /* PropertySignature */:
@@ -114007,7 +113869,7 @@ function transformDeclarations(context) {
114007
113869
  ensureModifiers(input),
114008
113870
  input.name,
114009
113871
  input.questionToken,
114010
- ensureType(input)
113872
+ ensureType(input, input.type)
114011
113873
  ));
114012
113874
  case 173 /* MethodSignature */: {
114013
113875
  if (isPrivateIdentifier(input.name)) {
@@ -114023,7 +113885,7 @@ function transformDeclarations(context) {
114023
113885
  input.questionToken,
114024
113886
  ensureTypeParams(input, input.typeParameters),
114025
113887
  updateParamsList(input, input.parameters),
114026
- ensureType(input)
113888
+ ensureType(input, input.type)
114027
113889
  ));
114028
113890
  }
114029
113891
  case 179 /* CallSignature */: {
@@ -114032,7 +113894,7 @@ function transformDeclarations(context) {
114032
113894
  input,
114033
113895
  ensureTypeParams(input, input.typeParameters),
114034
113896
  updateParamsList(input, input.parameters),
114035
- ensureType(input)
113897
+ ensureType(input, input.type)
114036
113898
  )
114037
113899
  );
114038
113900
  }
@@ -114055,7 +113917,7 @@ function transformDeclarations(context) {
114055
113917
  input.name,
114056
113918
  /*exclamationToken*/
114057
113919
  void 0,
114058
- ensureType(input),
113920
+ ensureType(input, input.type),
114059
113921
  ensureNoInitializer(input)
114060
113922
  ));
114061
113923
  }
@@ -114183,12 +114045,11 @@ function transformDeclarations(context) {
114183
114045
  errorNode: input
114184
114046
  });
114185
114047
  errorFallbackNode = input;
114186
- const type = ensureType(input);
114187
114048
  const varDecl = factory2.createVariableDeclaration(
114188
114049
  newId,
114189
114050
  /*exclamationToken*/
114190
114051
  void 0,
114191
- type,
114052
+ resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker),
114192
114053
  /*initializer*/
114193
114054
  void 0
114194
114055
  );
@@ -114296,7 +114157,7 @@ function transformDeclarations(context) {
114296
114157
  input.name,
114297
114158
  ensureTypeParams(input, input.typeParameters),
114298
114159
  updateParamsList(input, input.parameters),
114299
- ensureType(input),
114160
+ ensureType(input, input.type),
114300
114161
  /*body*/
114301
114162
  void 0
114302
114163
  ));
@@ -114462,7 +114323,7 @@ function transformDeclarations(context) {
114462
114323
  ensureModifiers(param),
114463
114324
  param.name,
114464
114325
  param.questionToken,
114465
- ensureType(param),
114326
+ ensureType(param, param.type),
114466
114327
  ensureNoInitializer(param)
114467
114328
  ),
114468
114329
  param
@@ -114484,7 +114345,11 @@ function transformDeclarations(context) {
114484
114345
  elem.name,
114485
114346
  /*questionOrExclamationToken*/
114486
114347
  void 0,
114487
- ensureType(elem),
114348
+ ensureType(
114349
+ elem,
114350
+ /*type*/
114351
+ void 0
114352
+ ),
114488
114353
  /*initializer*/
114489
114354
  void 0
114490
114355
  ));
@@ -114633,7 +114498,11 @@ function transformDeclarations(context) {
114633
114498
  e.name,
114634
114499
  /*exclamationToken*/
114635
114500
  void 0,
114636
- ensureType(e),
114501
+ ensureType(
114502
+ e,
114503
+ /*type*/
114504
+ void 0
114505
+ ),
114637
114506
  /*initializer*/
114638
114507
  void 0
114639
114508
  );
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.5.0-pr-57589-6",
5
+ "version": "5.5.0-pr-55267-105",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "b0b5ebd41df6b05007d778c368b282c546755196"
116
+ "gitHead": "08fd328ae8db41b37b49839d6d27ba07882a88c9"
117
117
  }