vegardit / prisma-generator-nestjs-dto

Generates NestJS DTO classes from Prisma Schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect prisma client import from for generated DTOs

Mingyang-Li opened this issue · comments

❌ Problem:

  1. Current import import {Prisma} from '@prisma/client' is incorrect/outdated, it's causing lots of import errors, a bit of pain to manually correct if you have quite a few tables/entities
  2. Current generated DTO has Eslint issues => annoying to fix myself when I have 30+ files to fix (on top of the import issue above)
import {Prisma} from '@prisma/client'




export class CreateCaloriesDto {
  dateTime?: Date;
value?: Prisma.Decimal;
date?: Date;
}

✅ Expected behaviour:

The package should generate import { PrismaClient } from '@prisma/client'; for each generated dto/entity/class files, and correct the corresponding types that use the old import, rather than keep using the old import {Prisma} from '@prisma/client' for all generated files

For e.g:

💀 Old/incorrect version with import errors

import {Prisma} from '@prisma/client';

export class CreateCaloriesDto {
  dateTime?: Date;
  value?: Prisma.Decimal;
  date?: Date;
}

🙂 Expected/correct new DTO with correct PrismaClient import

import { PrismaClient } from '@prisma/client';

export class CreateCaloriesDto {
  dateTime?: Date;
  value?: PrismaClient.Decimal;
  date?: Date;
}