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

Add generic type to getAll #75

Merged
merged 2 commits into from
Apr 19, 2021

Conversation

camchenry
Copy link
Contributor

Previously, getAll returned the type any[], even though it returned additional properties. Now, the entity type is correctly inferred (similar to findFirst, findMany, etc.).

Previously, getAll returned the type . Now, it correctly infers the type of the entities.
@camchenry camchenry mentioned this pull request Apr 19, 2021
@camchenry
Copy link
Contributor Author

Looks I was a bit hasty to put up this PR. I was having some issues building/testing locally (fixed now), but it looks like there is a typing issue in the Database class.

@kettanaito
Copy link
Member

kettanaito commented Apr 19, 2021

Hey, @camchenry. No worries. I've addressed the incompatibility of types and added a typings test case so we can catch regressions for this. Also made all the Database methods to accept the ModelName generic so it can be inferred upon internal usage (in the factory). I believe it's ready now.

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a superb addition. Thank you, @camchenry, and welcome to contributors!

Let us know if you'd like to tackle some other open issues. We'd appreciate your feedback on them.

@kettanaito kettanaito merged commit 31cb5c5 into mswjs:master Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants