data icon indicating copy to clipboard operation
data copied to clipboard

test(findMany): add failing test for querying by null

Open kettanaito opened this issue 3 years ago • 1 comments

  • Fixes #186

kettanaito avatar Jan 26 '22 15:01 kettanaito

Insights

I suspect that the type produced by Value is not correct:

https://github.com/mswjs/data/blob/d32f15461fc0ef915da6709de62e9e9156b8a234/src/glossary.ts#L211-L212

First of all, it misses the | null union type. But even when added, it still remains just a plain model value type without the null union. I have no idea why this happens, neither I have the tools to debug this with the current types complexity of Data.

Eventually, a null check must be introduced to the queryTypes.ts to produce a proper query type:

https://github.com/mswjs/data/blob/d32f15461fc0ef915da6709de62e9e9156b8a234/src/query/queryTypes.ts#L88-L89

kettanaito avatar Feb 05 '22 12:02 kettanaito