diff --git a/src/packages/client/src/generation/TSClient.ts b/src/packages/client/src/generation/TSClient.ts index 5686766213d3..fefdc9964288 100644 --- a/src/packages/client/src/generation/TSClient.ts +++ b/src/packages/client/src/generation/TSClient.ts @@ -140,6 +140,25 @@ export declare const prismaVersion: PrismaVersion * Utility Types */ +/** + * From https://github.com/sindresorhus/type-fest/ + * Matches a JSON object. + * This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. + */ +declare type JsonObject = {[Key in string]?: JsonValue} + +/** + * From https://github.com/sindresorhus/type-fest/ + * Matches a JSON array. + */ +declare interface JsonArray extends Array {} + +/** + * From https://github.com/sindresorhus/type-fest/ + * Matches any valid JSON value. + */ +declare type JsonValue = string | number | boolean | null | JsonObject | JsonArray + declare type SelectAndInclude = { select: any include: any @@ -153,7 +172,6 @@ declare type HasInclude = { include: any } - declare type CheckSelect = T extends SelectAndInclude ? 'Please either choose \`select\` or \`include\`' : T extends HasSelect diff --git a/src/packages/client/src/runtime/utils/common.ts b/src/packages/client/src/runtime/utils/common.ts index 1c9a8de3af56..6e2cc01c801b 100644 --- a/src/packages/client/src/runtime/utils/common.ts +++ b/src/packages/client/src/runtime/utils/common.ts @@ -45,7 +45,7 @@ export const GraphQLScalarToJSTypeTable = { DateTime: ['Date', 'string'], ID: 'string', UUID: 'string', - Json: 'object', + Json: 'JsonValue', } export const JSTypeToGraphQLType = {