cutSignature

tcmts.cli.main.cutSignature · #7uorgxub · term · runs anywhere

A signature on one line, cut at width (tcm view shows all of it): a long literal type, or an object type written over lines, doesn't flood a listing.

import { SIGNATURE_WIDTH } from "#codebase/tcmts/cli/main";

export function cutSignature(sig: string, width = SIGNATURE_WIDTH): string {
  const one = sig.replace(/\s*\n\s*/g, " ");
  return one.length > width ? `${one.slice(0, width - 1)}…` : one;
}

uses

used by