Skip to content

Search the guides, deployment pages, and API reference.

TokenSchema

import type { TokenSchema } from "@pitlane/theme/schema";

A remix/data-schema schema that also names the token type it declares. Every factory in this module returns one.

See

color

Extends

  • Schema<unknown, string>

Type Parameters

tag

tag extends SchemaTag = SchemaTag

Properties

[TAG]

readonly [TAG]: tag;

~run

~run: (value: unknown, context: ValidationContext) => ValidationResult<string>;

Internal validator used to validate nested values while preserving path/options.

Parameters

value

unknown

context

ValidationContext

Returns

ValidationResult<string>

Inherited from

Schema.~run

~standard

~standard: SyncStandardSchemaProps<unknown, string>;

Inherited from

Schema.~standard

pipe

pipe: (...checks: Check<string>[]) => Schema<unknown, string>;

Compose one or more reusable checks onto this schema.

Checks run after the underlying schema has validated and produced an output value. If any check fails, validation fails with an issue (using the check's message if provided).

Parameters

checks

...Check<string>[]

One or more Checks to apply in order

Returns

Schema<unknown, string>

A new schema with the checks applied

Inherited from

Schema.pipe

refine

refine: (predicate: (value: string) => boolean, message?: string) => Schema<unknown, string>;

Add an inline predicate check onto this schema.

The predicate runs after the underlying schema has validated and produced an output value. If the predicate returns false, validation fails with an issue.

Parameters

predicate

(value: string) => boolean

A function that returns true for valid values

message?

string

Optional issue message when the predicate fails

Returns

Schema<unknown, string>

A new schema with the refinement applied

Inherited from

Schema.refine

transform

transform: <newOutput>(transformer: (value: string) => newOutput) => Schema<unknown, newOutput>;

Transform the output of this schema with a function.

The transform function runs after the underlying schema has validated and produced an output value. The returned schema has a different output type.

Type Parameters

newOutput

newOutput

Parameters

transformer

(value: string) => newOutput

A function that transforms the validated output

Returns

Schema<unknown, newOutput>

A new schema with the transformation applied

Inherited from

Schema.transform