arktype icon indicating copy to clipboard operation
arktype copied to clipboard

Spread syntax for merging object literals

Open ssalbdivad opened this issue 1 year ago • 0 comments

Would allow objects to be flexibly merged in an object literal definition like this:

const types = scope({
  user: {
    isAdmin: "false",
    name: "string"
  },
  admin: {
    "...": "user",
    "isAdmin": "true"
  }
})

For now one per object definition (enforced by the uniqueness of the "..." key) since mapped type key ordering isn't guaranteed to be preserved.

ssalbdivad avatar May 10 '23 17:05 ssalbdivad