Docs (4.0.0)
class ManagedRecord method

create

Creates a new instance of this class, with the provided property values.

static

static create<TRecord extends ManagedRecord, T extends ManagedRecord.PartialProperties<TRecord> | {}>(this: {
    new (): TRecord;
}, properties?: T): TRecord & T

Notes

  • This method can be called both on ManagedRecord itself, as well as on a subclass; in both cases, the return type includes class properties and any other properties provided.

Example

// Create new record using the base class
let r = ManagedRecord.create({ foo: "bar" });
r.foo // => "bar"

// Create new record using a subclass
class MyRecord extends ManagedRecord {
  foo = "";
}
let myRecord = MyRecord.create({ foo: "bar" });
myRecord.foo // => "bar"

Related