Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toGlobalId expects ID as a string #218

Closed
intellix opened this issue Nov 12, 2018 · 0 comments · Fixed by #344
Closed

toGlobalId expects ID as a string #218

intellix opened this issue Nov 12, 2018 · 0 comments · Fixed by #344

Comments

@intellix
Copy link

intellix commented Nov 12, 2018

Was debugging an issue where TypeScript complains that I'm passing a number into toGlobalId and that it should be a string: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/graphql-relay/index.d.ts#L293

Decided to look upstream to this library and found that the same thing exists here:

export function toGlobalId(type: string, id: string): string {
return base64([ type, id ].join(':'));
}

The ID parameter is very likely going to be a number, especially with it being extremely common to use autoincrement integers in database rows.

Should the type be: string | number? If so, I can make the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant