Open AhmedElywa opened 3 years ago
issue when we have Prisma name used in our files
Before the codemod
import { PrismaClient } from '@prisma/client' import { PrismaDelete, onDeleteArgs } from '@paljs/plugins' class Prisma extends PrismaClient { constructor(options?: PrismaClientOptions) { super(options) } async onDelete(args: onDeleteArgs) { const prismaDelete = new PrismaDelete(this) await prismaDelete.onDelete(args) } } const prisma = new Prisma()
After the codemod
import { PrismaClient, Prisma } from '@prisma/client' import { PrismaDelete, onDeleteArgs } from '@paljs/plugins' class Prisma extends PrismaClient { constructor(options?: Prisma.PrismaClientOptions) { super(options) } async onDelete(args: onDeleteArgs) { const prismaDelete = new PrismaDelete(this) await prismaDelete.onDelete(args) } } const prisma = new Prisma()
Expected output
import { PrismaClient, Prisma as PrismaType } from '@prisma/client' import { PrismaDelete, onDeleteArgs } from '@paljs/plugins' class Prisma extends PrismaClient { constructor(options?: PrismaType.PrismaClientOptions) { super(options) } async onDelete(args: onDeleteArgs) { const prismaDelete = new PrismaDelete(this) await prismaDelete.onDelete(args) } } const prisma = new Prisma()
But look, it's not a big deal developer can do this manually
If I have some time I'll have a look
issue when we have Prisma name used in our files
Before the codemod
After the codemod
Expected output