Preparing search index...
    • Attaches a database-assigned id to a Draft, producing the persisted element.

      Use this instead of inlining { ...draft, id } after an insert returns the new row id.

      Type Parameters

      • T extends { id: number }

        A persisted element type whose id is a required number

      Parameters

      • draft: Draft<T>

        The draft to promote

      • id: number

        The database-assigned id to attach

      Returns T

      The persisted element with its id set