Skip to content

Commit

Permalink
improv(client): Return JsonValue type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed May 29, 2020
1 parent 878bae6 commit bf4426e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/packages/client/src/generation/TSClient.ts
Expand Up @@ -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<JsonValue> {}
/**
* 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
Expand All @@ -153,7 +172,6 @@ declare type HasInclude = {
include: any
}
declare type CheckSelect<T, S, U> = T extends SelectAndInclude
? 'Please either choose \`select\` or \`include\`'
: T extends HasSelect
Expand Down
2 changes: 1 addition & 1 deletion src/packages/client/src/runtime/utils/common.ts
Expand Up @@ -45,7 +45,7 @@ export const GraphQLScalarToJSTypeTable = {
DateTime: ['Date', 'string'],
ID: 'string',
UUID: 'string',
Json: 'object',
Json: 'JsonValue',
}

export const JSTypeToGraphQLType = {
Expand Down

0 comments on commit bf4426e

Please sign in to comment.