[GH-ISSUE #26] [suggestion] type for variables #18

Closed
opened 2026-03-03 00:02:46 +03:00 by kerem · 2 comments
Owner

Originally created by @dlq84 on GitHub (Dec 13, 2019).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/26

variables should have a type, it is well defined in the README but uses any.

My suggestion:

type Value = string | number | boolean | Record<string, any>;

interface Variables {
  value: Value;
  type?: string;
  required?: true;
}

type VariablesRecord<T extends Record<string, any> = Record<string, any>> = Record<keyof T, Variables>;

and query<T>() mutate<T>() etc

Originally created by @dlq84 on GitHub (Dec 13, 2019). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/26 variables should have a type, it is well defined in the README but uses `any`. My suggestion: ``` type Value = string | number | boolean | Record<string, any>; interface Variables { value: Value; type?: string; required?: true; } type VariablesRecord<T extends Record<string, any> = Record<string, any>> = Record<keyof T, Variables>; ``` and `query<T>()` `mutate<T>()` etc
kerem 2026-03-03 00:02:46 +03:00
Author
Owner

@atulmy commented on GitHub (Jan 3, 2020):

@dlq84 feel free to open a PR for this use case.

<!-- gh-comment-id:570673280 --> @atulmy commented on GitHub (Jan 3, 2020): @dlq84 feel free to open a PR for this use case.
Author
Owner

@Devorein commented on GitHub (Jul 5, 2020):

This has been included in the latest release (in a limited way) @dlq84

<!-- gh-comment-id:653846551 --> @Devorein commented on GitHub (Jul 5, 2020): This has been included in the latest release (in a limited way) @dlq84
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#18
No description provided.