Skip to content

Self reference model with Typescript and MST v3 #943

Closed
@AndrewSorokin

Description

@AndrewSorokin

I have some issue with explicit model typing in v3.

I need to get model with self reference with typescript.
There is solution #417 for MST v2 smth. like that:


interface IModel {
    key: string;
    reference: IModel;

    prop: number;
}
export const Model: IModelType<ISnapshottable<IModel>, IModel> = types.model({
    key: types.identifier,
    reference: types.late(() => Model),

    prop: types.number
})

What is a proper way to express model type with MST v3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions