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

feat(sequelize.d.ts) add operatorsAliases constructor option #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/sequelize.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ export interface Options {
* Defaults to false
*/
typeValidation?: boolean;

/**
* String based operator alias, default value is true which will enable all operators alias. Pass object to limit set of aliased operators or false to disable completely.
*
* Defaults to true
*/
operatorsAliases?: boolean | object;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use a more precise type than object, e.g. an index signature or an interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that creating an interface here would require porting the OperatorAliases into an Typescipt interface, then referencing that interface in our sequelize.d.ts file. Does that seem like a reasonable approach? Here are the operator aliases from the Sequelize source code: https://github.com/sequelize/sequelize/blob/master/lib/operators.js

I was hoping this would have already been done in the other Sequelize type definitions, but I can't seem to find it here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/v3/index.d.ts I'm happy to implement this port when I have some time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

They are all here:

export interface WhereOperators {

Should be possible to use a mapped type.

DefinitelyTyped has nothing to do with this repo.

}

export interface QueryOptionsTransactionRequired { }
Expand Down