Skip to main content

Function: scalarTsType()

function scalarTsType(type, opts?): string;

Defined in: packages/ir/src/helpers.ts:441

The TS type a non-nullable, non-list value of this field maps to, as a source string every generator's typed output must agree on. Returns a ScalarTsType token for scalars (bytes -> 'Uint8Array', json -> 'JsonValue', decimal kept as 'string' to preserve precision — runtime representation stays each generator's choice), the enum type name for { kind: 'enum' } (identifiers are never prefixed, ADR-0004), and 'unknown' for { kind: 'unknown' }.

Parameters​

ParameterType
typeFieldType
opts?{ dateType?: "string" | "date" | "temporal"; format?: | "date" | "datetime" | "uuid" | "email" | "url" | "cuid" | "cuid2" | "ulid" | "time" | "duration" | "ipv4" | "ipv6"; }
opts.dateType?"string" | "date" | "temporal"
opts.format?| "date" | "datetime" | "uuid" | "email" | "url" | "cuid" | "cuid2" | "ulid" | "time" | "duration" | "ipv4" | "ipv6"

Returns​

string