@@ -3451,8 +3451,7 @@ namespace ts {
34513451 resolvedReturnType : Type ,
34523452 typePredicate : TypePredicate | undefined ,
34533453 minArgumentCount : number ,
3454- hasRestParameter : boolean ,
3455- hasLiteralTypes : boolean ,
3454+ flags : SignatureFlags
34563455 ) : Signature ;
34573456 /* @internal */ createSymbol ( flags : SymbolFlags , name : __String ) : TransientSymbol ;
34583457 /* @internal */ createIndexInfo ( type : Type , isReadonly : boolean , declaration ?: SignatureDeclaration ) : IndexInfo ;
@@ -4671,7 +4670,22 @@ namespace ts {
46714670 Construct ,
46724671 }
46734672
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+
46744686 export interface Signature {
4687+ /* @internal */ flags : SignatureFlags ;
4688+ /* @internal */ checker ?: TypeChecker ;
46754689 declaration ?: SignatureDeclaration | JSDocSignature ; // Originating declaration
46764690 typeParameters ?: readonly TypeParameter [ ] ; // Type parameters (undefined if non-generic)
46774691 parameters : readonly Symbol [ ] ; // Parameters
@@ -4688,10 +4702,6 @@ namespace ts {
46884702 /* @internal */
46894703 minArgumentCount : number ; // Number of non-optional parameters
46904704 /* @internal */
4691- hasRestParameter : boolean ; // True if last parameter is rest parameter
4692- /* @internal */
4693- hasLiteralTypes : boolean ; // True if specialized
4694- /* @internal */
46954705 target ?: Signature ; // Instantiation target
46964706 /* @internal */
46974707 mapper ?: TypeMapper ; // Instantiation mapper
@@ -4702,11 +4712,11 @@ namespace ts {
47024712 /* @internal */
47034713 canonicalSignatureCache ?: Signature ; // Canonical version of signature (deferred)
47044714 /* @internal */
4715+ optionalCallSignatureCache ?: Signature ; // Optional chained call version of signature (deferred)
4716+ /* @internal */
47054717 isolatedSignatureType ?: ObjectType ; // A manufactured type that just contains the signature for purposes of signature comparison
47064718 /* @internal */
47074719 instantiations ?: Map < Signature > ; // Generic signature instantiation cache
4708- /* @internal */
4709- isOptionalCall ?: boolean ;
47104720 }
47114721
47124722 export const enum IndexKind {
0 commit comments