types/sequelize

Model.increment is missing.

Closed this issue · 1 comments

I might create a PR later for this as I already fixed it locally.

As I probably will not have the time:

// NOTE: I moved many common properties into their own interfaces to deduplicate code, you should do the same!!!
/**
 * Options used for Instance.increment method
 */
export interface IncrementDecrementOptions extends Logging, Transactionable, Silent, SearchPathable {

  /**
   * A hash of attributes to describe your search. See above for examples.
   */
  where?: WhereOptions;
}

/**
 * Options used for Instance.increment method
 */
export interface IncrementDecrementOptionsWithBy extends IncrementDecrementOptions {

  /**
   * The number to increment by
   *
    * Defaults to 1
   */
  by?: number;
}

  /**
   * Increments a single field.
   */
  static increment<M extends Model, K extends keyof M>(this: {new (): M}, field: K, options: IncrementDecrementOptionsWithBy): Promise<this>;

  /**
   * Increments multiple fields by the same value.
   */
  static increment<M extends Model, K extends keyof M>(this: {new (): M}, fields: K[], options: IncrementDecrementOptionsWithBy): Promise<this>;

  /**
   * Increments multiple fields by different values.
   */
  static increment<M extends Model, K extends keyof M>(this: {new (): M}, fields: { [key in K]?: number }, options: IncrementDecrementOptions): Promise<this>;