mswjs / data

Data modeling and relation library for testing JavaScript applications.

Home Page:https://npm.im/@mswjs/data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getAll is not generic

camchenry opened this issue · comments

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

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

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