public toString()

in src/docgen/transpile/transpile.ts [396:421]


  public toString(options?: TranspiledTypeReferenceToStringOptions): string {
    const tFormatter = options?.typeFormatter ?? ((t) => t.fqn);
    const sFormatter = options?.stringFormatter ?? ((s) => s);
    if (this.primitive) {
      return sFormatter(this.primitive);
    }
    if (this.type) {
      return tFormatter(this.type);
    }
    if (this.isAny) {
      return sFormatter(this.transpile.any());
    }
    if (this.arrayOfType) {
      const ref = this.arrayOfType.toString(options);
      return this.transpile.listOf(ref);
    }
    if (this.mapOfType) {
      const ref = this.mapOfType.toString(options);
      return this.transpile.mapOf(ref);
    }
    if (this.unionOfTypes) {
      const refs = this.unionOfTypes.map((t) => t.toString(options));
      return this.transpile.unionOf(refs);
    }
    throw new Error(`Invalid type reference: ${this.ref.toString()}`);
  }