Skip to content

Improve support for entities with id: number #944

Open
@queicherius

Description

@queicherius

You can currently use numeric IDs / cursors, but you have to manually pass the generic: https://github.com/devoxa/prisma-relay-cursor-connection/blob/master/tests/index.spec.ts#L194

//                                            v Model type
const result = await findManyCursorConnection<User, { id: number }>(
//                                                    ^ Cursor generic

You can also not use select or include, because of the manually provided generics.

With some TS magic (that I could not figure out so far) it might be possible to make this automatically infer the correct types.

If someone want to take a stab at it, I provided some additional tests & type checks on the https://github.com/devoxa/prisma-relay-cursor-connection/tree/fix-generics-with-number-id-2 branch. The tests already pass (as expected) but the type checks in the test file do not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions