@@ -3451,8 +3451,7 @@ namespace ts {
3451
3451
resolvedReturnType : Type ,
3452
3452
typePredicate : TypePredicate | undefined ,
3453
3453
minArgumentCount : number ,
3454
- hasRestParameter : boolean ,
3455
- hasLiteralTypes : boolean ,
3454
+ flags : SignatureFlags
3456
3455
) : Signature ;
3457
3456
/* @internal */ createSymbol ( flags : SymbolFlags , name : __String ) : TransientSymbol ;
3458
3457
/* @internal */ createIndexInfo ( type : Type , isReadonly : boolean , declaration ?: SignatureDeclaration ) : IndexInfo ;
@@ -4671,7 +4670,22 @@ namespace ts {
4671
4670
Construct ,
4672
4671
}
4673
4672
4673
+ /* @internal */
4674
+ export const enum SignatureFlags {
4675
+ None = 0 ,
4676
+ HasRestParameter = 1 << 0 , // Indicates last parameter is rest parameter
4677
+ HasLiteralTypes = 1 << 1 , // Indicates signature is specialized
4678
+ IsOptionalCall = 1 << 2 , // Indicates signature comes from a CallChain
4679
+
4680
+ // We do not propagate `IsOptionalCall` to instantiated signatures, as that would result in us
4681
+ // attempting to add `| undefined` on each recursive call to `getReturnTypeOfSignature` when
4682
+ // instantiating the return type.
4683
+ PropagatingFlags = HasRestParameter | HasLiteralTypes ,
4684
+ }
4685
+
4674
4686
export interface Signature {
4687
+ /* @internal */ flags : SignatureFlags ;
4688
+ /* @internal */ checker ?: TypeChecker ;
4675
4689
declaration ?: SignatureDeclaration | JSDocSignature ; // Originating declaration
4676
4690
typeParameters ?: readonly TypeParameter [ ] ; // Type parameters (undefined if non-generic)
4677
4691
parameters : readonly Symbol [ ] ; // Parameters
@@ -4688,10 +4702,6 @@ namespace ts {
4688
4702
/* @internal */
4689
4703
minArgumentCount : number ; // Number of non-optional parameters
4690
4704
/* @internal */
4691
- hasRestParameter : boolean ; // True if last parameter is rest parameter
4692
- /* @internal */
4693
- hasLiteralTypes : boolean ; // True if specialized
4694
- /* @internal */
4695
4705
target ?: Signature ; // Instantiation target
4696
4706
/* @internal */
4697
4707
mapper ?: TypeMapper ; // Instantiation mapper
@@ -4702,11 +4712,11 @@ namespace ts {
4702
4712
/* @internal */
4703
4713
canonicalSignatureCache ?: Signature ; // Canonical version of signature (deferred)
4704
4714
/* @internal */
4715
+ optionalCallSignatureCache ?: Signature ; // Optional chained call version of signature (deferred)
4716
+ /* @internal */
4705
4717
isolatedSignatureType ?: ObjectType ; // A manufactured type that just contains the signature for purposes of signature comparison
4706
4718
/* @internal */
4707
4719
instantiations ?: Map < Signature > ; // Generic signature instantiation cache
4708
- /* @internal */
4709
- isOptionalCall ?: boolean ;
4710
4720
}
4711
4721
4712
4722
export const enum IndexKind {
0 commit comments