Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolveIdentifier type signature doesn't allow for snapshotProcessor types #1778

Open
3 tasks done
adamkovalsky opened this issue Aug 30, 2021 · 1 comment
Open
3 tasks done
Labels
help/PR welcome Help/Pull request from contributors to fix the issue is welcome Typescript Issue related to Typescript typings

Comments

@adamkovalsky
Copy link
Contributor

Bug report

  • I've checked documentation and searched for existing issues
  • I've made sure my project is based on the latest MST version
  • 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.

@coolsoftwaretyler
Copy link
Collaborator

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.

@coolsoftwaretyler coolsoftwaretyler added help/PR welcome Help/Pull request from contributors to fix the issue is welcome Typescript Issue related to Typescript typings labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help/PR welcome Help/Pull request from contributors to fix the issue is welcome Typescript Issue related to Typescript typings
Projects
None yet
Development

No branches or pull requests

2 participants