Skip to content

Chain custom runtimes with other runtypes #101

@sbley

Description

@sbley

How can I use custom runtimes (that transform a value into another type) with other runtypes?

For example, if I wanted to verify an optional BigInt type:

st.optional(bigIntRuntype()) // 🛑

This would fail because bigIntRuntype() returns bigint whereas st.optional() expects Runtype<unknown> as a parameter.

With the built-in runtypes, it works. Example:

st.optional(stringAsInteger()) // ✅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions