import { Temporal } from "temporal-spec"; declare namespace helpers_d_exports { export { DeepReadonly, DeepWritable, InferFieldsOutput, IsUnion, JsonCompatible, JsonValue, NullableToOptional, Prettify, SerializeDates, TypeLevelError, UnionToIntersection, output }; } export type Prettify = { [K in keyof T as string extends K ? never : K]: T[K]; } & {}; export type TypeLevelError = { readonly $error: Message; }; export type UnionToIntersection = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; export type IsUnion = T extends unknown ? [U] extends [T] ? false : true : never; export type DeepWritable = T extends Date | Temporal.PlainDate | Temporal.Instant | Temporal.PlainTime | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable; } & {} : T; export type DeepReadonly = T extends Date | Temporal.PlainDate | Temporal.Instant | Temporal.PlainTime | RegExp | Function ? T : T extends readonly (infer E)[] ? readonly DeepReadonly[] : T extends object ? { readonly [K in keyof T]: DeepReadonly; } : T; export type output = T extends { _output: infer U; } ? DeepWritable : never; /** * Replace `Date` and supported Temporal values with `string` throughout a type. * * Values that reach user code as a parsed JSON payload cannot carry a `Date` * or Temporal instance, so a type describing such a payload must * report the serialized form even when the type it derives from uses one of * those representations. */ export type SerializeDates = T extends Date | Temporal.PlainDate | Temporal.Instant | Temporal.PlainTime ? string : T extends RegExp | Function ? T : T extends object ? { [K in keyof T]: SerializeDates; } : T; export type NullableToOptional = { [K in keyof T as null extends T[K] ? never : K]: T[K]; } & { [K in keyof T as null extends T[K] ? K : never]?: T[K]; }; export type InferFieldsOutput> = DeepWritable; }>>>; export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue; }; /** * A looser version of JsonValue that accepts interfaces. * TypeScript interfaces don't have index signatures by default, so they can't * be assigned to JsonValue's `{ [key: string]: JsonValue }`. This type uses a * recursive structural check instead. * * Rejection rules: * - Functions are rejected (top-level or as property values). * - Objects with a `toJSON` method are rejected (can't faithfully round-trip). * - Class instances that expose methods are rejected via the property walk * (methods are function-typed properties, which resolve to `never`). * * Limitation: class instances whose declared type has only data properties * (for example `Error`, or user-defined DTO classes) are structurally * indistinguishable from plain objects and cannot be rejected here. The * platform performs the authoritative check at runtime. */ export type JsonCompatible = T extends string | number | boolean | null | undefined ? T : T extends readonly (infer U)[] ? JsonCompatible[] : T extends Function ? never : T extends object ? T extends { toJSON: () => unknown; } ? never : { [K in keyof T]: JsonCompatible; } : never; //#endregion export { helpers_d_exports };