---
source: crates/normalize-typegen/tests/codegen.rs
assertion_line: 290
expression: output
---
// Auto-generated by normalize-typegen

/** A domain event with discriminated payload */
export type Event =
  | {
      type: "user.created";
      payload: UserCreatedPayload;
      timestamp: Timestamp;
    }
  | {
      type: "user.deleted";
      payload: UserDeletedPayload;
      timestamp: Timestamp;
    }
  | {
      type: "order.placed";
      payload: OrderPlacedPayload;
      timestamp: Timestamp;
    };

/** An item in an order */
export interface OrderItem {
  price: number;
  productId: string;
  quantity: number;
}

/** Payload for order placement events */
export interface OrderPlacedPayload {
  items: OrderItem[];
  orderId: string;
  total: number;
  userId: string;
}

/** A result type that can be success or error */
export type Result =
  | {
      status: "success";
      data: unknown;
    }
  | {
      status: "error";
      error: unknown;
    };

/** ISO 8601 timestamp */
export type Timestamp = string;

/** Payload for user creation events */
export interface UserCreatedPayload {
  email: string;
  name: string;
  userId: string;
}

/** Payload for user deletion events */
export interface UserDeletedPayload {
  reason?: string;
  userId: string;
}
