Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Incorrect typing for where #9

Closed
EirikFA opened this issue Apr 18, 2020 · 1 comment
Closed

Incorrect typing for where #9

EirikFA opened this issue Apr 18, 2020 · 1 comment

Comments

@EirikFA
Copy link

EirikFA commented Apr 18, 2020

I believe where should use the same type for querying as TypeORM (FindManyOptions<Entity> or FindOneOptions<Entity>). Is this correct? If so, I'd be happy to submit a PR updating it.

@Mando75
Copy link
Owner

Mando75 commented Apr 18, 2020

@EirikFA The loader actually uses the QueryBuilder API under the hood which uses this as the type signature:

  // From TypeORM type definitions

    /**
     * Sets WHERE condition in the query builder.
     * If you had previously WHERE expression defined,
     * calling this function will override previously set WHERE conditions.
     * Additionally you can add parameters used in where expression.
     */
    where(where: Brackets | string | ((qb: this) => string) | ObjectLiteral | ObjectLiteral[], parameters?: ObjectLiteral): this;

I agree that the typing for the where argument should be better, and I have already improved it in a refactor of the package that I am actually working on as we speak :) If you would like a preview of what that will look like, please check out https://gql-loader.bmuller.net/ for the WIP documentation & types of the refactored package. There is still a bit of cleanup required there to get everything in line with how TypeORM types their stuff, but it is close to what the final result will be. At the end of the day, the where method of the dataloader will match the type signature of the where method in the TypeORM query builder.

@Mando75 Mando75 closed this as completed Apr 18, 2020
Mando75 added a commit that referenced this issue Aug 29, 2020
Resolve "Implement Field Decorators"

Closes #9 and #10

See merge request Mando75/typeorm-graphql-loader!17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants