Skip to content

Commit

Permalink
Move signature declaration helper length approximation to start of fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
weswigham committed May 7, 2021
1 parent 0f4e922 commit 60be8f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5354,6 +5354,7 @@ namespace ts {
function signatureToSignatureDeclarationHelper(signature: Signature, kind: SignatureDeclaration["kind"], context: NodeBuilderContext, options?: SignatureToSignatureDeclarationOptions): SignatureDeclaration {
const suppressAny = context.flags & NodeBuilderFlags.SuppressAnyReturnType;
if (suppressAny) context.flags &= ~NodeBuilderFlags.SuppressAnyReturnType; // suppress only toplevel `any`s
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
let typeParameters: TypeParameterDeclaration[] | undefined;
let typeArguments: TypeNode[] | undefined;
if (context.flags & NodeBuilderFlags.WriteTypeArgumentsOfSignature && signature.target && signature.mapper && signature.target.typeParameters) {
Expand Down Expand Up @@ -5397,7 +5398,6 @@ namespace ts {
const flags = modifiersToFlags(modifiers);
modifiers = factory.createModifiersFromModifierFlags(flags | ModifierFlags.Abstract);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum

const node =
kind === SyntaxKind.CallSignature ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) :
Expand Down

0 comments on commit 60be8f1

Please sign in to comment.