typeorm-cursor-pagination
typeorm-cursor-pagination copied to clipboard
unknown type in cursor for branded ids
trafficstars
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
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();
}
- 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
Hi @rares-lupascu
Thanks for your feedback and propose your use case, the PR is welcome!
done #35