Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant