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

fix(types): update BelongsToManyGetAssociationsMixinOptions definition #11818

merged 5 commits into from Jan 21, 2020

fix(types): update BelongsToManyGetAssociationsMixinOptions definition #11818

merged 5 commits into from Jan 21, 2020


Copy link

@thrymgjol thrymgjol commented Jan 12, 2020

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in

Description of change

This will add the joinTableAttributes property to the BelongsToManyGetAssociationsMixinOptions interface.

belongs-to-many.d.ts defines an interface named JoinTableAttributes:

export interface JoinTableAttributes {
  [attribute: string]: unknown;

However, this does not seem to be the appropriate type for this property. In belongs-to-many.js, joinTableAttributes is assigned to the attributes property of a set of include options, so I used the same type as the attributes property from IncludeOptions (FindAttributeOptions).

    association: this.oneFromTarget,
    attributes: options.joinTableAttributes,
    required: true,
    where: throughWhere

@thrymgjol thrymgjol requested a review from SimonSchick Jan 18, 2020
Copy link

@papb papb commented Jan 18, 2020

Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future!

Copy link

@papb papb left a comment

Please add at least one test to make sure your implementation works as intended and to prevent regressions in the future.

Testing the TypeScript typings consists simply on checking if some code can be compiled. In other words, a typings test is just some TS code that should compile. What it does when executed is irrelevant, the test is simply to compile it without errors, as can be seen in our CI configuration (using npm run test-typings) here and here. Since it's just a compilation, getting no output from it means that it passed. Getting a compilation error is a failure. Note that if you directly throw an error from your typings test code, the test will still pass because throwing an error is something that compiles just fine.

For good examples on how to write typescript typings, check the following PRs: #11368 #11378 #11520

Let me know if you need further help!

Copy link

@codecov codecov bot commented Jan 18, 2020

Codecov Report

Merging #11818 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11818   +/-   ##
  Coverage   96.26%   96.26%           
  Files          94       94           
  Lines        9191     9191           
  Hits         8848     8848           
  Misses        343      343

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00211a5...ffbf3da. Read the comment docs.

@papb papb added status: awaiting response type: typescript labels Jan 18, 2020
@thrymgjol thrymgjol removed the request for review from SimonSchick Jan 20, 2020
Oliver Emery added 2 commits Jan 20, 2020
…ion' of into update-BelongsToManyGetAssociationsMixinOptions-definition
@thrymgjol thrymgjol requested a review from papb Jan 20, 2020
papb approved these changes Jan 20, 2020
Copy link

@papb papb commented Jan 20, 2020

Thank you!!

@papb papb removed the status: awaiting response label Jan 20, 2020
@papb papb self-assigned this Jan 20, 2020
@papb papb merged commit 1f42c79 into sequelize:master Jan 21, 2020
4 checks passed
@papb papb removed their assignment Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
type: typescript
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants