#2560·instant

Feature request: enum type

Author: zd4yCreated Apr 15, 2026Updated Apr 17, 2026

Hello, it would be really nice to have an enum type. Currently this can be done with i.string() but it doesn't provide type safety. For getting the type safety I have to override AppSchema and also use as MyEnum in the data returned by useQuery. I also need to add perms to make sure invalid data never gets inserted.

For example let's say I have a status: i.string().indexed() field in a groupInvitations entity that only accepts 'pending' | 'accepted' | 'declined'

I need to override the AppSchema like this:

typescript
export type InvitationStatus = 'pending' | 'accepted' | 'declined'

export type AppSchema = Omit<_AppSchema, 'entities'> & {
  entities: Omit<_AppSchema['entities'], 'groupInvitations'> & {
    groupInvitations: Omit<_AppSchema['entities']['groupInvitations'], 'status'> & {
      status: InvitationStatus
    }
  }
}

And when I use the data:

typescript
const { data } = db.useQuery(...)
const status = data.groupInvitations[0].status as InvitationStatus

And in the instant.perms.ts file:

typescript
  groupInvitations: {
    allow: {
      create: 'validStatus',
      update: 'validStatus',
    },
    bind: {
      validStatus: "data.status in ['pending', 'accepted', 'declined']",
    },
  },

With support for an enum type I would hope to be able to get all of this automatically just by specifying the valid enum values.