text

tcmts.cli.commands.text · #mohqrvnk · term · runs anywhere

Text; required unless there's a default.

import { valid } from "#codebase/tcmts/cli/commands";
import type { Schema } from "#codebase/tcmts/cli/commands";

export function text(): Schema<string>;
export function text(fallback: string): Schema<string>;
export function text(fallback: undefined | null): Schema<string | undefined>;
export function text(fallback?: string | null): Schema<string | undefined> {
  return valid((v) => (typeof v === "string" ? { value: v } : v === undefined && fallback !== undefined ? { value: fallback ?? undefined } : { issues: [{ message: "required" }] }));
}

uses

used by