Literal schema interface.

interface LiteralSchema<
    TLiteral extends Literal,
    TMessage extends ErrorMessage<LiteralIssue> | undefined,
> {
    "~run": (
        dataset: UnknownDataset,
        config: Config<BaseIssue<unknown>>,
    ) => OutputDataset<TLiteral, LiteralIssue>;
    "~standard": StandardProps<TLiteral, TLiteral>;
    "~types"?: { input: TLiteral; issue: LiteralIssue; output: TLiteral };
    async: false;
    expects: string;
    kind: "schema";
    literal: TLiteral;
    message: TMessage;
    reference: {
        <const TLiteral extends Literal>(
            literal_: TLiteral,
        ): LiteralSchema<TLiteral, undefined>;
        <
            const TLiteral extends Literal,
            const TMessage extends undefined | ErrorMessage<LiteralIssue>,
        >(
            literal_: TLiteral,
            message: TMessage,
        ): LiteralSchema<TLiteral, TMessage>;
    };
    type: "literal";
}

Type Parameters

Hierarchy (View Summary)

Properties

"~run": (
    dataset: UnknownDataset,
    config: Config<BaseIssue<unknown>>,
) => OutputDataset<TLiteral, LiteralIssue>

Parses unknown input values.

Type declaration

The Standard Schema properties.

"~types"?: { input: TLiteral; issue: LiteralIssue; output: TLiteral }

The input, output and issue type.

async: false

Whether it's async.

expects: string

The expected property.

kind: "schema"

The object kind.

literal: TLiteral

The literal value.

message: TMessage

The error message.

reference: {
    <const TLiteral extends Literal>(
        literal_: TLiteral,
    ): LiteralSchema<TLiteral, undefined>;
    <
        const TLiteral extends Literal,
        const TMessage extends undefined | ErrorMessage<LiteralIssue>,
    >(
        literal_: TLiteral,
        message: TMessage,
    ): LiteralSchema<TLiteral, TMessage>;
}

The schema reference.

Type declaration

type: "literal"

The schema type.