arthurfiorette / prisma-json-types-generator

⚒️ Changes JsonValues to your custom typescript type.
https://npm.im/prisma-json-types-generator
MIT License
364 stars 20 forks source link

fix: make nots optional #255

Closed kenny-stevens closed 7 months ago

kenny-stevens commented 7 months ago

Upon using this generator I've ran into an issue where the not condition was mandatory for some of the typed filters.

I think this was a mistake, so I've pushed a PR where this is no longer the case, alongside some tests.

Before this fix when making a WHERE IN, we'd be forced to make a WHERE NOT as well by ts.

Example before fix:

    prismaClient.someModel.findFirst({
      where: {
        someColumn: {
          in: [ ...listOfValues ],
          not: 'I have to include a not condition too otherwise ts complains :( how sad'
        },
      },
    });

Now

    prismaClient.someModel.findFirst({
      where: {
        someColumn: {
          in: [ ...listOfValues ],
        },
      },
    });
arthurfiorette commented 7 months ago

Thanks!