Create a record type.

function createRecordType<R extends UnknownRecord>(
  typeName: R['typeName'],
  config: {
    ephemeralKeys?: {
      readonly [K in Exclude<keyof R, 'id' | 'typeName'>]: boolean
    }
    scope: RecordScope
    validator?: StoreValidator<R>
  }
): RecordType<R, keyof Omit<R, 'id' | 'typeName'>>
Example
const Book = createRecordType<Book>('book')
Parameters
NameDescription

typeName

R['typeName']

The name of the type to create.

config

{
  ephemeralKeys?: {
    readonly [K in Exclude<
      keyof R,
      'id' | 'typeName'
    >]: boolean
  }
  scope: RecordScope
  validator?: StoreValidator<R>
}
Returns
RecordType<R, keyof Omit<R, 'id' | 'typeName'>>
createMigrationSequencedefineMigrations