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): adds 'hooks' to CreateOptions #11736

Merged
merged 6 commits into from Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 2 additions & 12 deletions types/lib/associations/base.d.ts
@@ -1,4 +1,4 @@
import { ColumnOptions, Model, ModelCtor } from '../model';
import { ColumnOptions, Model, ModelCtor, HookOptions } from '../model';

export abstract class Association<S extends Model = Model, T extends Model = Model> {
public associationType: string;
Expand Down Expand Up @@ -42,17 +42,7 @@ export interface ForeignKeyOptions extends ColumnOptions {
/**
* Options provided when associating models
*/
export interface AssociationOptions {
/**
* Set to true to run before-/afterDestroy hooks when an associated model is deleted because of a cascade.
* For example if `User.hasOne(Profile, {onDelete: 'cascade', hooks:true})`, the before-/afterDestroy hooks
* for profile will be called when a user is deleted. Otherwise the profile will be deleted without invoking
* any hooks.
*
* @default false
*/
hooks?: boolean;

export interface AssociationOptions extends HookOptions {
/**
* The alias of this model, in singular form. See also the `name` option passed to `sequelize.define`. If
* you create multiple associations between the same tables, you should provide an alias to be able to
Expand Down
9 changes: 3 additions & 6 deletions types/lib/instance-validator.d.ts
@@ -1,4 +1,6 @@
export interface ValidationOptions {
import { HookOptions } from "./model";

export interface ValidationOptions extends HookOptions {
/**
* An array of strings. All properties that are in this array will not be validated
*/
Expand All @@ -7,9 +9,4 @@ export interface ValidationOptions {
* An array of strings. Only the properties that are in this array will be validated
*/
fields?: string[];
/**
* Run before and after validate hooks.
* @default true.
*/
hooks?: boolean;
}