Skip to main content

Type Alias: Carries<M *extends* object>

Required, not optional, since optional is satisfied by any plain number. Plain key, not unique symbol, to avoid TS4023 in a consumer's own build.

Carries<M extends object> = number & { __carries: M; }

Defined in: brand.ts:18

Required, not optional, since optional is satisfied by any plain number. Plain key, not unique symbol, to avoid TS4023 in a consumer's own build.

Type Declaration

__carries

readonly __carries: M

Type Parameters

M

M extends object

The meta shape the code carries.

Example

const REGISTRY = {
  WIDGET_NOT_FOUND: detail<{ widgetId: string }>(404),
} as const satisfies Record<string, number>
const { throwError } = createErrorKit('AppError', REGISTRY)

// @ts-expect-error meta is required, not optional
throwError('WIDGET_NOT_FOUND')
throwError('WIDGET_NOT_FOUND', { widgetId: 'w1' }) // ok