chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
579 stars 43 forks source link

Generate sources throw error when using importsNotUsedAsValues tsconfig opion #96

Closed juh9870 closed 1 year ago

juh9870 commented 1 year ago

when "importsNotUsedAsValues": "error", generated sources throw an error, because they use import { type Prisma } from '@prisma/client'; instead of import type { Prisma } from '@prisma/client';

chrishoermann commented 1 year ago

@juh9870 I don't know what you mean by "they use import { type Prisma } from '@prisma/client';"?

The generator should generate import type { Prisma } from '@prisma/client';. Is this not the case on your end?

juh9870 commented 1 year ago

Yes, it generates import { type... Have just updated to 2.3.5, and problem still remains. My prisma config:

generator zod {
  provider                  = "zod-prisma-types"
  createRelationValuesTypes = true
}

Full project: https://github.com/juh9870/library-backend

chrishoermann commented 1 year ago

@juh9870 sorry my bad. had some code fragments where the described import was used. should be fixed in the latest version.

juh9870 commented 1 year ago

Issue still remains, I use single file generation, so this line is problematic: https://github.com/chrishoermann/zod-prisma-types/blob/0a6162121ed679038bff0c587a8111a8887d8a59/packages/generator/src/functions/writeSingleFileImportStatements.ts#L21