mobx-state-tree
mobx-state-tree copied to clipboard
resolveIdentifier type signature doesn't allow for snapshotProcessor types
Bug report
- [x] I've checked documentation and searched for existing issues
- [x] I've made sure my project is based on the latest MST version
- [x] Fork this code sandbox or another minimal reproduction.
Sandbox link or minimal reproduction code https://codesandbox.io/s/kind-jepsen-cifwx?file=/src/index.ts
Describe the expected behavior
resolveIdentifier should allow for snapshotProcessor types to be provided as the type argument.
Describe the observed behavior
The compiler complains because the type signature of resolveIdentifier doesn't allow for snapshotProcessor types to be provided. Note that at run-time it accepts the type and works as expected, it's only the type definition that's too narrow.
The type definition could be expanded from IAnyModelType to IAnyComplexType to resolve this, but this would also allow other "complex" types such as types.array and types.map as input, which is probably undesirable.
Thanks for the issue + reproduction, @adamkovalsky. Sorry it took so long for anyone to respond here.
I think your assessment makes sense. I'm going to label this issue as TypeScript and PR welcome, since we are actively interested in improving our TS types.
Totally understand if it's been so long you're uninterested in pitching in, but we'd be happy to review a PR to update these typings in MST. If you're unavailable, no worries. I'll keep this labeled for other contributors or hopefully the core team can get to it as well.