Skip to content

toGlobalId expects ID as a string #218

Closed
@intellix

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions