Skip to content

Instantly share code, notes, and snippets.

@KrisKnez
Created March 27, 2024 23:34
Show Gist options
  • Save KrisKnez/56089ffccf4bfcd4ac28ded5261f9417 to your computer and use it in GitHub Desktop.
Save KrisKnez/56089ffccf4bfcd4ac28ded5261f9417 to your computer and use it in GitHub Desktop.
IPrismaIntFilter.ts
import { Prisma } from '@prisma/client';
type IPrismaIntFilter<
Prefix extends string,
Delimiter extends string = '_',
Operations extends keyof Prisma.IntFilter = keyof Prisma.IntFilter,
> = {
[K in `${Prefix}${Delimiter}${keyof Pick<
Prisma.IntFilter,
Extract<'equals' | 'gt' | 'gte' | 'lt' | 'lte' | 'not', Operations>
>}`]?: string;
} & {
[K in `${Prefix}${Delimiter}${keyof Pick<Prisma.IntFilter, Extract<'in' | 'notIn', Operations>>}`]?: string[];
} & {
[K in `${Prefix}`]: Prisma.IntFilter;
};
export default IPrismaIntFilter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment