charto / classy-mst

ES6-like syntax for mobx-state-tree
MIT License
91 stars 5 forks source link

After upgrading to 3.8.0 typescript complains about circular dependencies in models #14

Closed Amareis closed 5 years ago

Amareis commented 5 years ago

In 3.7.0 there is no errors

Amareis commented 5 years ago
Error:(38, 7) TS7022: 'ItemData' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
Error:(38, 30) TS2345: Argument of type '{ id: ISimpleType<string>; __typename: ISimpleType<string>; notification: ISimpleType<"ON" | "OFF" | "MUTE">; notification_disabled_till: IMaybeNull<ISimpleType<string>>; ... 21 more ...; text: string; }' is not assignable to parameter of type 'ModelPropertiesDeclaration'.
  Property 'creator' is incompatible with index signature.
    Type 'IMaybeNull<IReferenceType<IModelType<ModelPropertiesDeclarationToProperties<{ id: ISimpleType<string>; state: ISimpleType<"ACTIVE" | "PENDING" | "MODERATION">; email: ISimpleType<string>; online: ISimpleType<boolean>; is_my: ISimpleType<boolean>; last_seen: IMaybeNull<...>; profile: IModelType<...>; avatar: IMaybeNu...' is not assignable to type 'string | number | boolean | IAnyType | Date'.
      Type 'IMaybeNull<IReferenceType<IModelType<ModelPropertiesDeclarationToProperties<{ id: ISimpleType<string>; state: ISimpleType<"ACTIVE" | "PENDING" | "MODERATION">; email: ISimpleType<string>; online: ISimpleType<boolean>; is_my: ISimpleType<boolean>; last_seen: IMaybeNull<...>; profile: IModelType<...>; avatar: IMaybeNu...' is not assignable to type 'Date'.
Amareis commented 5 years ago

Where creator is just

    creator: types.maybeNull(types.reference(User)),
Amareis commented 5 years ago

Oh, or it's mst issue? Not sure now, because User it's classy-mst class, but ItemData is simple mst types.model

jjrv commented 5 years ago

Do you have a minimal test case demonstrating the error?

Amareis commented 5 years ago

Oh, I caught it. Problems are in mst itself. https://github.com/mobxjs/mobx-state-tree/issues/1157

jjrv commented 5 years ago

I guess this can be closed.