Skip to content

Conversation

@EduardMcfly
Copy link

@EduardMcfly EduardMcfly commented Jan 18, 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 CONTRIBUTING.md?

Description of change

In the types of the where function, in the comparator parameter a symbol is added as type, this solves problems when using the constant Op the function where

Example of the problem i had:

import { Op } from 'sequelize';

Sequelize.where(
 Sequelize.fn('LOWER', Sequelize.col('email')),
 Op.like, // error Argument of type 'unique symbol' is not assignable to parameter of type 'string'.ts
 Sequelize.fn('LOWER', email + '%'),
)

Closes #11241

comparator parameter a symbol is added as type
@codecov
Copy link

codecov bot commented Jan 18, 2020

Codecov Report

Merging #11843 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11843      +/-   ##
==========================================
+ Coverage   96.26%   96.27%   +<.01%     
==========================================
  Files          94       94              
  Lines        9191     9203      +12     
==========================================
+ Hits         8848     8860      +12     
  Misses        343      343
Impacted Files Coverage Δ
lib/associations/belongs-to-many.js 98.07% <0%> (ø) ⬆️
lib/dialects/mariadb/data-types.js 100% <0%> (ø) ⬆️
lib/model.js 96.54% <0%> (ø) ⬆️
lib/dialects/abstract/query-generator.js 97.02% <0%> (ø) ⬆️

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 fbd19d9...93822f5. Read the comment docs.

@papb
Copy link
Member

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
Member

@papb papb left a comment

Choose a reason for hiding this comment

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

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!

@papb papb changed the title fix(tipings): In the where function, in the comparator parameter a symbol is added as type fix(typings): comparator arg of Sequelize.where Jan 18, 2020
@papb papb added status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action typescript For issues and PRs. Things that involve typescript, such as typings and intellisense. labels Jan 18, 2020
a symbol and a null value are added
@EduardMcfly
Copy link
Author

Good day

Already perform the tipings test and everything is working correctly, also add other types to the logic arg of Sequelize.where

@papb
Copy link
Member

papb commented Jan 21, 2020

Hello, you still haven't added a test.

@EduardMcfly
Copy link
Author

Hi Pedro, I already added some tests In the file types\test\where.ts

@papb
Copy link
Member

papb commented Jan 23, 2020

@andres112013 Thank you very much! Before merging I would like to wait for a review by @SimonSchick as well

@papb papb requested a review from SimonSchick January 23, 2020 21:51
@papb papb added status: awaiting maintainer and removed status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action labels Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typescript For issues and PRs. Things that involve typescript, such as typings and intellisense.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null is not supported as LogicType in TypeScript

3 participants