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

getAll is not generic #74

Closed
camchenry opened this issue Apr 19, 2021 · 2 comments
Closed

getAll is not generic #74

camchenry opened this issue Apr 19, 2021 · 2 comments

Comments

@camchenry
Copy link
Contributor

Hi,

I am using this library in a TypeScript-heavy project and I noticed that the getAll function does not properly infer the generic type of the database entity. The properties still exist in the object, but TypeScript doesn't know about it so it can't auto-complete the properties or provide any type checking for them.

Screenshot:
image

Here is a CodeSandbox which should highlight the issue:
https://codesandbox.io/s/mswjs-getall-typescript-error-1cde3?file=/src/App.tsx

@camchenry
Copy link
Contributor Author

Opened a PR (#75) to fix the TypeScript definition for this function.

@kettanaito
Copy link
Member

Hey, @camchenry. Thank you for raising this and preparing a pull request! I'll review it and let's have these typings improved.

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

No branches or pull requests

2 participants