Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/helpers/find-signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function findNewSignature(
// String
//
case 'string':
case 'Prisma.StringFieldUpdateOperationsInput | string':
if (!shouldReplaceStrings) {
break;
}
Expand All @@ -69,6 +70,37 @@ export function findNewSignature(
result = `(${typeToChange})[]`;
break;

case 'number':
case 'Prisma.IntFieldUpdateOperationsInput | number':
case 'Prisma.FloatFieldUpdateOperationsInput | number':
if (!shouldReplaceStrings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you've added types to number and reusing this flag, maybe we should rename this variable to somewhat like replacePrimitive?

break;
}

result = typeToChange;
break;

case `Prisma.${model}Update${field}Input | string[]`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should move these lines after L65

case `Prisma.${model}Create${field}Input | string[]`:
case `Prisma.${model}Update${field}Input | number[]`:
case `Prisma.${model}Create${field}Input | number[]`:
if (!shouldReplaceStrings) {
break;
}

result = `(${typeToChange})[]`;
break;

case `Prisma.NullableIntFieldUpdateOperationsInput | number | null`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether these lines can be merged with the case on L104

case `Prisma.NullableFloatFieldUpdateOperationsInput | number | null`:
case `Prisma.NullableStringFieldUpdateOperationsInput | string | null`:
if (!shouldReplaceStrings) {
break;
}

result = `${typeToChange} | null`;
break;

case 'string | null':
if (!shouldReplaceStrings) {
break;
Expand Down
Loading