Skip to content

Commit 60be8f1

Browse files
committed
Move signature declaration helper length approximation to start of function
1 parent 0f4e922 commit 60be8f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5354,6 +5354,7 @@ namespace ts {
53545354
function signatureToSignatureDeclarationHelper(signature: Signature, kind: SignatureDeclaration["kind"], context: NodeBuilderContext, options?: SignatureToSignatureDeclarationOptions): SignatureDeclaration {
53555355
const suppressAny = context.flags & NodeBuilderFlags.SuppressAnyReturnType;
53565356
if (suppressAny) context.flags &= ~NodeBuilderFlags.SuppressAnyReturnType; // suppress only toplevel `any`s
5357+
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
53575358
let typeParameters: TypeParameterDeclaration[] | undefined;
53585359
let typeArguments: TypeNode[] | undefined;
53595360
if (context.flags & NodeBuilderFlags.WriteTypeArgumentsOfSignature && signature.target && signature.mapper && signature.target.typeParameters) {
@@ -5397,7 +5398,6 @@ namespace ts {
53975398
const flags = modifiersToFlags(modifiers);
53985399
modifiers = factory.createModifiersFromModifierFlags(flags | ModifierFlags.Abstract);
53995400
}
5400-
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
54015401

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

0 commit comments

Comments
 (0)