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): Add definition of returning in SaveOptions as it was missing. #16954

Merged
merged 3 commits into from Feb 18, 2024

Conversation

onozaty
Copy link

@onozaty onozaty commented Jan 13, 2024

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to [the documentation repository](https://github.com/sequelize/website/)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description Of Change

In the type definition file, the return of SaveOptions was omitted.

sequelize/src/model.d.ts

Lines 1284 to 1307 in cb8ea88

/**
* Options used for Instance.save method
*/
export interface SaveOptions<TAttributes = any> extends Logging, Transactionable, Silent, Hookable {
/**
* An optional array of strings, representing database columns. If fields is provided, only those columns
* will be validated and saved.
*/
fields?: (keyof TAttributes)[];
/**
* If false, validations won't be run.
*
* @default true
*/
validate?: boolean;
/**
* A flag that defines if null values should be passed as values or not.
*
* @default false
*/
omitNull?: boolean;
}

They are present in the actual code.

sequelize/src/model.js

Lines 4016 to 4022 in cb8ea88

if (options.returning === undefined) {
if (options.association) {
options.returning = false;
} else if (this.isNewRecord) {
options.returning = true;
}
}

This pull request adds the missing returning.

There was no problem with the v7 codes.

Todos

In the type definition file, the return of SaveOptions was omitted.
They are present in the actual code.
@WikiRik WikiRik added the v6 label Jan 13, 2024
ephys
ephys previously approved these changes Feb 11, 2024
Copy link
Member

@ephys ephys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small code style change, but otherwise good to go

src/model.d.ts Outdated Show resolved Hide resolved
Co-authored-by: Alyx <zoe@ephys.dev>
Copy link
Member

@ephys ephys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ephys ephys enabled auto-merge (squash) February 18, 2024 00:24
@ephys ephys disabled auto-merge February 18, 2024 00:24
@ephys ephys enabled auto-merge (squash) February 18, 2024 00:24
@ephys ephys merged commit 505467b into sequelize:v6 Feb 18, 2024
52 checks passed
Copy link
Contributor

🎉 This PR is included in version 6.37.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants