Closed uncledu closed 2 years ago
Find a solution for this issue, i'll wirte the solution here for anyone face the same situation.
const SubModel = types.model(...)
const DemoModel = types.model('DemoModel', {
id: types.identifier,
largeSubModel: types.optional(types.late(():IAnyModel=> SubModel))
}).views((self)=>{})
.actions((self)=>{})
for example, make the large sub model as up showing late, it'll turn it to be any type.
then, define a new interface as follow
interface IDemoModelReal extends Omit<DemoModel, 'largeSubModel' > {
largeSubModel: SubModel;
}
const DemoModelTreeInsrtance = DemoModel.create({});
// export like this, will make the type correct
export DemoModelTreeInstance as IDemoModelReal
Question how to solve the ts7056 error, can't build project now.
in my project, i have defined a root model(contains serveral sub model), seems it's so big that typescript compiler told me that it's too big, also cause build failure.