payload: {"action":"created","issue":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/38118","repository_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped","labels_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/38118/labels{/name}","comments_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/38118/comments","events_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/38118/events","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38118","id":488953823,"node_id":"MDU6SXNzdWU0ODg5NTM4MjM=","number":38118,"title":"[@types/redux-orm] Types of property are incompatible","user":{"login":"JonnyLinja","id":684861,"node_id":"MDQ6VXNlcjY4NDg2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/684861?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyLinja","html_url":"https://github.com/JonnyLinja","followers_url":"https://api.github.com/users/JonnyLinja/followers","following_url":"https://api.github.com/users/JonnyLinja/following{/other_user}","gists_url":"https://api.github.com/users/JonnyLinja/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyLinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyLinja/subscriptions","organizations_url":"https://api.github.com/users/JonnyLinja/orgs","repos_url":"https://api.github.com/users/JonnyLinja/repos","events_url":"https://api.github.com/users/JonnyLinja/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyLinja/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2019-09-04T05:47:05Z","updated_at":"2019-09-10T01:47:12Z","closed_at":null,"author_association":"NONE","body":"@keenondrums @tomasz-zablocki \r\n\r\n**SUMMARY OF THE ISSUE**\r\n\r\n0.13.4 allowed use of optional SessionBoundModels and QuerySets in interfaces when upserting / creating / updating.\r\n\r\n0.13.5 has a types of property are incompatible error.\r\n\r\n**THE SETUP**\r\n\r\nI've set my interfaces to have optional SessionBoundModels and QuerySets. This is done so I can query related model objects when pulling from redux-orm, but not need to define them when inserting new objects. An example is as follows, where the team relation of groups is optional.\r\n```\r\nexport interface GroupProperties {\r\n    readonly id: string;\r\n    readonly name: string;\r\n    readonly team_id: string;\r\n\r\n    readonly team?: SessionBoundModel<TeamsModel, {}>;\r\n}\r\n```\r\n\r\n**WHAT I EXPECT TO HAPPEN**\r\n\r\nWith 0.13.4, I am able to pass the interface into the generic field when using upserts, creates, and updates. TypeScript properly warns me if I'm missing a property that I need.\r\n```\r\nclass GroupsModel extends Model<typeof GroupsModel, GroupProperties> {\r\n    static reducer(action: Actions, Groups: ModelType<GroupsModel> ) {\r\n        // edited reducer for simplicity\r\n        // this works great in 0.13.4!\r\n        Groups.upsert<GroupProperties>({\r\n            id: action.id.toLowerCase(),\r\n            name: action.name,\r\n            team_id: action.team_id.toLowerCase(),\r\n        });\r\n    }\r\n}\r\nGroupsModel.modelName = 'Groups';\r\n\r\nGroupsModel.fields = {\r\n    name: attr(),\r\n    team_id: fk({\r\n        to: 'Teams',\r\n        as: 'team',\r\n        relatedName: 'groups',\r\n    }),\r\n};\r\n\r\nexport default GroupsModel;\r\n```\r\n\r\n**WHAT ACTUALLY HAPPENS**\r\n\r\nHowever, with 0.13.5, I get the following error.\r\n```\r\nType 'GroupProperties' does not satisfy the constraint 'BlueprintProps<GroupsModel, \"id\", \"name\" | \"team_id\" | \"team\">'.\r\n  Type 'GroupProperties' is not assignable to type '{ readonly name?: string | undefined; readonly team_id?: string | undefined; readonly team?: undefined; }'.\r\n    Types of property 'team' are incompatible.\r\n      Type 'SessionBoundModel<TeamsModel, {}> | undefined' is not assignable to type 'undefined'.\r\n        Type 'SessionBoundModel<TeamsModel, {}>' is not assignable to type 'undefined'.ts(2344)\r\n```\r\n\r\nSwitching between TypeScript 3.5.2 and 3.6.2 did not resolve the error. Downgrading to 0.13.4 resolved the errors. Not having the team SessionBoundModel in the interface resolves the error with 0.13.5. \r\n\r\nIf this is working as intended, what is the suggested method of using TypeScript with redux-orm such that I can still access related model objects, and yet have type checking on upserts, updates, and creates?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/comments/529733129","html_url":"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/38118#issuecomment-529733129","issue_url":"https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/issues/38118","id":529733129,"node_id":"MDEyOklzc3VlQ29tbWVudDUyOTczMzEyOQ==","user":{"login":"JonnyLinja","id":684861,"node_id":"MDQ6VXNlcjY4NDg2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/684861?v=4","gravatar_id":"","url":"https://api.github.com/users/JonnyLinja","html_url":"https://github.com/JonnyLinja","followers_url":"https://api.github.com/users/JonnyLinja/followers","following_url":"https://api.github.com/users/JonnyLinja/following{/other_user}","gists_url":"https://api.github.com/users/JonnyLinja/gists{/gist_id}","starred_url":"https://api.github.com/users/JonnyLinja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonnyLinja/subscriptions","organizations_url":"https://api.github.com/users/JonnyLinja/orgs","repos_url":"https://api.github.com/users/JonnyLinja/repos","events_url":"https://api.github.com/users/JonnyLinja/events{/privacy}","received_events_url":"https://api.github.com/users/JonnyLinja/received_events","type":"User","site_admin":false},"created_at":"2019-09-10T01:47:12Z","updated_at":"2019-09-10T01:47:12Z","author_association":"NONE","body":"@tomasz-zablocki \r\n\r\nGiven an interface like so\r\n```\r\nexport interface GroupProperties {\r\n    readonly id: string;\r\n    readonly name: string;\r\n    readonly team_id: string;\r\n\r\n    readonly team?: TeamsModel;\r\n}\r\n```\r\n\r\nif I send an action with this interface\r\n```\r\nexport interface GroupAction {\r\n    type: typeof GROUP_TEST_ACTION;\r\n    readonly group: GroupProperties;\r\n}\r\n```\r\n\r\nthen the following attempt to upsert, in both 0.13.4 and 0.13.5\r\n```\r\nclass GroupsModel extends Model<typeof GroupsModel, GroupProperties> {\r\n\r\n    static modelName = 'Groups' as const;\r\n\r\n    static fields = {\r\n        name: attr(),\r\n        team_id: fk({\r\n            to: 'Teams',\r\n            as: 'team',\r\n            relatedName: 'groups',\r\n        }),\r\n    };\r\n\r\n    static reducer(action: GroupAction, Groups: ModelType<GroupsModel>) {\r\n        Groups.upsert(action.group);\r\n    }\r\n}\r\n\r\nexport default GroupsModel;\r\n```\r\n\r\nresults in \r\n```\r\nArgument of type 'GroupProperties' is not assignable to parameter of type 'BlueprintProps<GroupsModel, \"id\", \"team\" | \"name\" | \"team_id\">'.\r\n  Type 'GroupProperties' is not assignable to type '{ readonly team?: undefined; readonly name?: string | undefined; readonly team_id?: string | undefined; }'.\r\n    Types of property 'team' are incompatible.\r\n      Type 'TeamsModel | undefined' is not assignable to type 'undefined'.\r\n        Type 'TeamsModel' is not assignable to type 'undefined'.ts(2345)\r\n```\r\n\r\nIn your tests, you have payload replicating the interface of the Fields rather than actually being the fields. Is this the only solution? I ask as I work with the Properties (or Fields in your tests) a lot in code, sometimes passing them through multiple sagas before they update the store. In many cases, I'll do something like `Groups.withId(action.id).update(action.group)` where `action.group` is a `Partial<GroupProperties>`.\r\n\r\n```\r\ninterface CreateBookAction {\r\n    type: 'CREATE_BOOK';\r\n    // payload here replicates BookFields rather than just specifying BookFields\r\n    payload: { coverArt?: string; title: string; publisher: number; authors?: string[] };\r\n}\r\n```"}}
other: {"actor":{"display_login":"JonnyLinja"}}