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'.
...
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