sikanhe / gqtx

Code-first Typescript GraphQL Server without codegen or metaprogramming
458 stars 13 forks source link

t.ID should be string | number, not any #11

Closed FedericoBiccheddu closed 4 years ago

FedericoBiccheddu commented 4 years ago

Currently t.ID is inferred as any, but the GraphQL spec says:

The ID type is serialized in the same way as a String [...]. While it is often numeric, it should always serialize as a String. and

Input Coercion When expected as an input type, any string (such as "4") or integer (such as 4) input value should be coerced to ID as appropriate for the ID formats a given GraphQL server expects. Any other input value, including float input values (such as 4.0), must raise a query error indicating an incorrect type.

My proposal is to change t.ID from any to string | number

PS: Thanks for the amazing library.