Skip to content

link

link<T>(TargetModel): TypeWrapper<InstanceType<T>>

Defined in: .work/repos/edinburgh/src/types.ts:825

Create a link type wrapper for model relationships.

T extends (…args) => any

The target model class.

T

The model class this link points to.

TypeWrapper<InstanceType<T>>

A link type instance.

const Author = E.defineModel("Author", class {
id = E.field(E.identifier);
posts = E.field(E.array(E.link(() => Book)));
}, { pk: "id" });
const Book = E.defineModel("Book", class {
id = E.field(E.identifier);
author = E.field(E.link(Author));
}, { pk: "id" });

link<T>(TargetModel): TypeWrapper<InstanceType<T>>

Defined in: .work/repos/edinburgh/src/types.ts:828

Create a link type wrapper for model relationships.

T extends (…args) => any

The target model class.

() => T

The model class this link points to.

TypeWrapper<InstanceType<T>>

A link type instance.

const Author = E.defineModel("Author", class {
id = E.field(E.identifier);
posts = E.field(E.array(E.link(() => Book)));
}, { pk: "id" });
const Book = E.defineModel("Book", class {
id = E.field(E.identifier);
author = E.field(E.link(Author));
}, { pk: "id" });