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

GraphOptions.joinOperation is incorrectly typed as required #1954

Closed
IlyaSemenov opened this issue Dec 27, 2020 · 2 comments
Closed

GraphOptions.joinOperation is incorrectly typed as required #1954

IlyaSemenov opened this issue Dec 27, 2020 · 2 comments

Comments

@IlyaSemenov
Copy link
Contributor

GraphOptions.joinOperation is typed as required here:

export interface GraphOptions {
minimize?: boolean;
separator?: string;
aliases?: string[];
joinOperation: string;
maxBatchSize?: number;
}

which is not correct because it defaults to leftJoin.

In particular, this leads to Typescript error in innocent uses like:

MyModel.query().withGraphFetched("foo", { maxBatchSize: 1 })

result:

Argument of type '{ maxBatchSize: number; }' is not assignable to parameter of type 'GraphOptions'.
  Property 'joinOperation' is missing in type '{ maxBatchSize: number; }' but required in type 'GraphOptions'.ts(2345)
@MatiasMinian
Copy link

Isn't also aliases incorrectly typed? We are having issues as well having the joinOperation as mandatory, but a bigger problem for us is the aliases which asks for a string[]. Based on the docs, it should be an object right?
Shouldn't it be: aliases?: { [key: string]: string }?

By the way, thanks for this amazing library!

Freakazo added a commit to Freakazo/objection.js that referenced this issue Feb 2, 2021
@ibrahimjamil
Copy link

poor typescript types

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

No branches or pull requests

4 participants