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

unknown type in cursor for branded ids #34

Open
rares-lupascu opened this issue Jul 17, 2021 · 4 comments · May be fixed by #35
Open

unknown type in cursor for branded ids #34

rares-lupascu opened this issue Jul 17, 2021 · 4 comments · May be fixed by #35

Comments

@rares-lupascu
Copy link

Hi

So my ids are branded to avoid miss-assignments
What that means is that instead of passing string is the type (uuid format) i am passing my custom type which is UserId
It looks like this:

interface ConversationId extends String {
    _conversationBrand: string;
}

so in this case I cannot create the pagination object:

"unknown type in cursor: [object]bee5b8e2-80ab-4ba8-b762-02c3e7337ca5"

any suggestion to avoid this?

thanks

@rares-lupascu
Copy link
Author

i think i have a fix for this
adding this in utils.ts after line 28 worked for me:

if (typeof value.toString === 'function') {
  return value.toString();
}

@rares-lupascu
Copy link
Author

  • this for the case 'object' when decoding the curos ... utils.ts line 43
if (typeof value.toString === 'function') {
   return value.toString();
}

i can create a PR if it helps

@benjamin658
Copy link
Owner

Hi @rares-lupascu

Thanks for your feedback and propose your use case, the PR is welcome!

@rares-lupascu
Copy link
Author

done #35

@benjamin658 benjamin658 linked a pull request Jul 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants