Skip to content

string.uuid infer type #1512

@hiendaovinh

Description

@hiendaovinh

Request a feature

🤷 Motivation

I'm validating with "string.uuid" and its variations and expecting the inference type should be more like "node:crypto" UUID instead of "string"

 type UUID = `${string}-${string}-${string}-${string}-${string}`;

💡 Solution

My current workaround

import type { UUID } from "node:crypto";
import { type } from "arktype";

export const UUIDBranded = type("string.uuid").pipe((s: UUID): UUID => s);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions