prefer-nominal-id-members
Distinguish identifier roles sharing primitive types in object types.
Why
A property annotated with a primitive type accepts identifiers from any domain that uses that type. A swap can survive type checking even when callers pass an object with named properties.
Fix
Parse identifiers with distinct branded Zod schemas at the input boundary. Use the schema output types for the corresponding properties in the domain object.
Examples
interface Receipt { accountId: string; invoiceId: string;}import { z } from "zod";const AccountId = z.string().brand<"AccountId">();const InvoiceId = z.string().brand<"InvoiceId">();interface Receipt { accountId: z.output<typeof AccountId>; invoiceId: z.output<typeof InvoiceId>;}