Skip to main content
Home

A generic, type-safe factory for working with discriminated unions in TypeScript.

This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (1.0.6)
T
AnyDto

Union of all DTO types that match the discriminator pattern.

f
createDtoFactory

Creates a DTO factory for a specific schema set and discriminator field.

f
createDtoHandler

Creates a switch-style handler that exhaustively handles all DTO types.

T
DiscriminatedKey

Gets all schema keys that have a literal value for the discriminator field.

T
DiscriminatorId

Union of all discriminator values (literal strings) for a given field.

T
DiscriminatorMap

Builds a map from discriminator values to their corresponding types.

I
DtoFactory

Interface for a type-safe DTO factory.

T
DtoHandlers

Type definition for exhaustive switch-style handlers.

T
ExtractFieldValue

Extracts the literal string value of a discriminator field from a type.

T
HasLiteralField

Filters types that have a literal (non-generic) string value for the given field. Returns never if the field doesn't exist or is a generic string type.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.