UNPKG

@mitcsutt/kiln-forms

Version:

Kiln forms: typed React forms on TanStack Form, in component or JSON schema mode, rendered through kiln-ui

17 lines (16 loc) • 877 B
import type { StandardSchemaV1Issue } from '@tanstack/react-form'; type PathSegment = PropertyKey | { readonly key: PropertyKey; }; /** * Formats an issue path the way TanStack names fields: `['guests', 0, 'name']` → `guests[0].name`. * Numeric segments (numbers or digit-only strings) become `[n]`. */ export declare function formatPath(path: readonly PathSegment[] | undefined): string; /** Normalises a dotted path written by hand or a server: `a.0.b` → `a[0].b`. Bracketed paths pass through. */ export declare function normalisePath(path: string): string; /** The path of a Standard Schema issue in TanStack form. */ export declare function issuePath(issue: StandardSchemaV1Issue): string; /** True when `path` is `prefix` itself or nested under it (`a`, `a.b`, `a[0]`). */ export declare function isAtOrUnder(path: string, prefix: string): boolean; export {};