sikanhe / gqtx

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

README example is broken #38

Closed Ericnr closed 3 years ago

Ericnr commented 3 years ago

Fields defined with t.ID should be able to take either a string or a number, as the default behavior is to stringify the value, but currently it expects it to be a string. The readme example runs into this problem

type User = {
  id: number;
  role: Role;
  name: string;
};

const UserType = t.objectType<User>({
  name: 'User',
  description: 'A User',
  fields: () => [
    t.defaultField('id', t.NonNull(t.ID)) // Type 'string | null' is not assignable to type 'number'.
...
sikanhe commented 3 years ago

Good catch, this became outdated due to https://github.com/sikanhe/gqtx/pull/13.

sikanhe commented 3 years ago

Fixed in master