Skip to content

Instantly share code, notes, and snippets.

@KrisKnez
Last active March 27, 2024 23:34
Show Gist options
  • Save KrisKnez/14f351a87c043bb40278c368e02419d8 to your computer and use it in GitHub Desktop.
Save KrisKnez/14f351a87c043bb40278c368e02419d8 to your computer and use it in GitHub Desktop.
IPrismaDateTimeFilter.ts
import { Prisma } from '@prisma/client';
type IPrismaDateTimeFilter<
Prefix extends string,
Delimiter extends string = '_',
Operations extends keyof Prisma.DateTimeFilter = keyof Prisma.DateTimeFilter,
> = {
[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.DateTimeFilter;
};
export default IPrismaDateTimeFilter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment