Skip to content

Commit

Permalink
fix(types): typo in typings (#15176)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzn0x committed Oct 24, 2022
1 parent ff43e8d commit c6bed01
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/dialects/abstract/query-generator.d.ts
@@ -1,7 +1,7 @@
// TODO: complete me - this file is a stub that will be completed when query-generator.ts is migrated to TS

import type {
BuiltModelAttributeColumOptions,
BuiltModelAttributeColumnOptions,
FindOptions,
Model,
ModelAttributeColumnOptions,
Expand Down Expand Up @@ -110,22 +110,22 @@ export class AbstractQueryGenerator {
insertQuery(
table: TableName,
valueHash: object,
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumOptions },
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumnOptions },
options?: InsertOptions
): { query: string, bind?: unknown[] };
bulkInsertQuery(
tableName: TableName,
newEntries: object[],
options?: BulkInsertOptions,
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumOptions }
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumnOptions }
): string;

updateQuery(
tableName: TableName,
attrValueHash: object,
where: WhereOptions,
options?: UpdateOptions,
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumOptions },
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumnOptions },
): { query: string, bind?: unknown[] };

deleteQuery(
Expand Down
4 changes: 2 additions & 2 deletions src/dialects/abstract/query-interface.d.ts
Expand Up @@ -10,7 +10,7 @@ import type {
ModelStatic,
CreationAttributes,
Attributes,
BuiltModelAttributeColumOptions,
BuiltModelAttributeColumnOptions,
} from '../../model';
import type { Sequelize, QueryRawOptions, QueryRawOptionsWithModel } from '../../sequelize';
import type { Transaction } from '../../transaction';
Expand Down Expand Up @@ -500,7 +500,7 @@ export class QueryInterface {
values: object,
where: WhereOptions<any>,
options?: QiOptionsWithReplacements,
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumOptions },
columnDefinitions?: { [columnName: string]: BuiltModelAttributeColumnOptions },
): Promise<object>;

/**
Expand Down
14 changes: 7 additions & 7 deletions src/model.d.ts
Expand Up @@ -1780,7 +1780,7 @@ export interface ModelAttributeColumnOptions<M extends Model = Model> extends Co
_autoGenerated?: boolean;
}

export interface BuiltModelAttributeColumOptions<M extends Model = Model> extends ModelAttributeColumnOptions<M> {
export interface BuiltModelAttributeColumnOptions<M extends Model = Model> extends ModelAttributeColumnOptions<M> {
/**
* The name of the attribute (JS side).
*/
Expand Down Expand Up @@ -2123,7 +2123,7 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
/**
* Like {@link Model.rawAttributes}, but only includes attributes that are part of the Primary Key.
*/
static readonly primaryKeys: { [attribute: string]: BuiltModelAttributeColumOptions };
static readonly primaryKeys: { [attribute: string]: BuiltModelAttributeColumnOptions };

static readonly uniqueKeys: {
[indexName: string]: {
Expand All @@ -2142,7 +2142,7 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
* @internal
*/
static readonly fieldRawAttributesMap: {
[columnName: string]: BuiltModelAttributeColumOptions,
[columnName: string]: BuiltModelAttributeColumnOptions,
};

/**
Expand All @@ -2161,7 +2161,7 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
* @internal
*/
static tableAttributes: {
[attributeName: string]: BuiltModelAttributeColumOptions,
[attributeName: string]: BuiltModelAttributeColumnOptions,
};

/**
Expand All @@ -2182,13 +2182,13 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
*
* @deprecated use {@link Model.getAttributes} for better typings.
*/
static readonly rawAttributes: { [attribute: string]: BuiltModelAttributeColumOptions };
static readonly rawAttributes: { [attribute: string]: BuiltModelAttributeColumnOptions };

/**
* Returns the attributes of the model
*/
static getAttributes<M extends Model>(this: ModelStatic<M>): {
readonly [Key in keyof Attributes<M>]: BuiltModelAttributeColumOptions
readonly [Key in keyof Attributes<M>]: BuiltModelAttributeColumnOptions
};

static getIndexes(): readonly IndexOptions[];
Expand Down Expand Up @@ -2312,7 +2312,7 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
*/
static mergeAttributesDefault(
newAttributes: { [key: string]: ModelAttributeColumnOptions }
): BuiltModelAttributeColumOptions;
): BuiltModelAttributeColumnOptions;

/**
* Creates this table in the database, if it does not already exist.
Expand Down
4 changes: 2 additions & 2 deletions src/utils/format.ts
Expand Up @@ -7,7 +7,7 @@ import type {
WhereOptions,
ModelAttributeColumnOptions,
Attributes,
BuiltModelAttributeColumOptions,
BuiltModelAttributeColumnOptions,
} from '..';
// eslint-disable-next-line import/order -- caused by temporarily mixing require with import
import { Op as operators } from '../operators';
Expand Down Expand Up @@ -260,7 +260,7 @@ export function generateEnumName(
return `enum_${tableName}_${columnName}`;
}

export function getColumnName(attribute: BuiltModelAttributeColumOptions): string {
export function getColumnName(attribute: BuiltModelAttributeColumnOptions): string {
assert(attribute.fieldName != null, 'getColumnName expects a normalized attribute meta');

// field is the column name alias
Expand Down
4 changes: 2 additions & 2 deletions test/unit/model/get-attributes.test.ts
@@ -1,9 +1,9 @@
import { DataTypes } from '@sequelize/core';
import type { BuiltModelAttributeColumOptions, DataType } from '@sequelize/core';
import type { BuiltModelAttributeColumnOptions, DataType } from '@sequelize/core';
import { expect } from 'chai';
import { sequelize, getTestDialectTeaser } from '../../support';

function assertDataType(property: BuiltModelAttributeColumOptions, dataType: DataType) {
function assertDataType(property: BuiltModelAttributeColumnOptions, dataType: DataType) {
expect(property.type).to.be.instanceof(dataType);
}

Expand Down

0 comments on commit c6bed01

Please sign in to comment.