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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kettanaito
Copy link
Member

const users = db.user.findMany({
where: {
organizationId: {
equals: null,
Copy link
Member Author

Choose a reason for hiding this comment

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

Querying nullable fields by null is a legal operation.

@kettanaito
Copy link
Member Author

Insights

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

data/src/glossary.ts

Lines 211 to 212 in d32f154

Target[Key] extends NullableProperty<any>
? ReturnType<Target[Key]['getValue']>

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:

export type GetQueryFor<ValueType extends any> = ValueType extends string
? StringQuery

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

1 participant