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

Incorrect prisma client import from for generated DTOs #128

Open
Mingyang-Li opened this issue May 28, 2022 · 0 comments
Open

Incorrect prisma client import from for generated DTOs #128

Mingyang-Li opened this issue May 28, 2022 · 0 comments

Comments

@Mingyang-Li
Copy link

Mingyang-Li commented May 28, 2022

❌ 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant