Public function

Create a record type.

Example
const Book = createRecordType<Book>('book')
Signature
function createRecordType<R extends UnknownRecord>(
  typeName: R['typeName'],
  config: {
    migrations?: Migrations
    validator?: StoreValidator<R>
    scope: RecordScope
  }
): RecordType<R, keyof Omit<R, 'id' | 'typeName'>>
Parameters
NameDescription

typeName

R['typeName']

The name of the type to create.

config

{
  migrations?: Migrations
  validator?: StoreValidator<R>
  scope: RecordScope
}
Returns
RecordType<R, keyof Omit<R, 'id' | 'typeName'>>
References

UnknownRecord, Migrations, StoreValidator, RecordType

Source

packages/store/src/lib/RecordType.ts

ComputedCachedefineMigrations