arthurfiorette / prisma-json-types-generator

⚒️ Changes JsonValues to your custom typescript type.
https://npm.im/prisma-json-types-generator
MIT License
362 stars 20 forks source link

When config.useType is true, type is double quoted #292

Open Arlen22 opened 5 months ago

Arlen22 commented 5 months ago

Prerequisites

Versions

Apparently all version since this was introduced?

A minimal reproducible example

none

Description

https://github.com/arthurfiorette/prisma-json-types-generator/blob/6d4fe1fe730567d2fa762f4b1b7153d944ff02ed/src/util/create-signature.ts#L24

This line results in the type name being double quoted. For some reason that I can't understand this does not always break things, but it does result in things randomly not working. I suspect that I've been ignoring the types and perhaps if someone was actually seriously relying on this feature it would be a bigger problem. Anyway, removing either the JSON.stringify or the surrounding quote is required.

Steps to Reproduce

Here's the generator from my schema.prisma file. Adding this to any file should be all you need to reproduce.

generator json {
  provider     = "prisma-json-types-generator"
  namespace    = "PrismaJson"
  clientOutput = "./client"
  useType      = "AllTypes"
}

Expected Behavior

No response

arthurfiorette commented 5 months ago

Hey! Thanks for this bug report, would you like to address this issue? Remember to add unit tests!