Skip to content

Commit 5ddfa61

Browse files
authored
fix: update to TypeScript 4.8 (#1453)
* fix: update to TypeScript 4.8 * style: fix lint
1 parent 9baa584 commit 5ddfa61

25 files changed

+83
-80
lines changed

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"source-map-support": "0.5.21",
138138
"sqlite3": "5.0.11",
139139
"ts-node": "10.9.1",
140-
"typescript": "4.7.4",
140+
"typescript": "4.8.4",
141141
"uuid-validate": "0.0.3"
142142
},
143143
"peerDependencies": {

src/associations/belongs-to-many/belongs-to-many-association.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { ModelType } from '../../model/model/model';
1010
import { ThroughOptions } from '../through/through-options';
1111

1212
export class BelongsToManyAssociation<
13-
TCreationAttributes,
14-
TModelAttributes,
15-
TCreationAttributesThrough,
16-
TModelAttributesThrough
13+
TCreationAttributes extends {},
14+
TModelAttributes extends {},
15+
TCreationAttributesThrough extends {},
16+
TModelAttributesThrough extends {}
1717
> extends BaseAssociation<TCreationAttributes, TModelAttributes> {
1818
constructor(
1919
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,

src/associations/belongs-to-many/belongs-to-many-options.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { BelongsToManyOptions as OriginBelongsToManyOptions } from 'sequelize';
22
import { ModelClassGetter } from '../../model/shared/model-class-getter';
33
import { ThroughOptions } from '../through/through-options';
44

5-
export type BelongsToManyOptions<TCreationAttributesThrough, TModelAttributesThrough> = {
5+
export type BelongsToManyOptions<
6+
TCreationAttributesThrough extends {},
7+
TModelAttributesThrough extends {}
8+
> = {
69
[K in keyof OriginBelongsToManyOptions]: K extends 'through'
710
?
811
| ModelClassGetter<TCreationAttributesThrough, TModelAttributesThrough>

src/associations/belongs-to-many/belongs-to-many.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ import { ModelClassGetter } from '../../model/shared/model-class-getter';
44
import { addAssociation } from '../shared/association-service';
55

66
export function BelongsToMany<
7-
TCreationAttributes,
8-
TModelAttributes,
9-
TCreationAttributesThrough,
10-
TModelAttributesThrough
7+
TCreationAttributes extends {},
8+
TModelAttributes extends {},
9+
TCreationAttributesThrough extends {},
10+
TModelAttributesThrough extends {}
1111
>(
1212
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
1313
through: ModelClassGetter<TCreationAttributesThrough, TModelAttributesThrough> | string,
1414
foreignKey?: string,
1515
otherKey?: string
1616
): Function;
1717
export function BelongsToMany<
18-
TCreationAttributes,
19-
TModelAttributes,
20-
TCreationAttributesThrough,
21-
TModelAttributesThrough
18+
TCreationAttributes extends {},
19+
TModelAttributes extends {},
20+
TCreationAttributesThrough extends {},
21+
TModelAttributesThrough extends {}
2222
>(
2323
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
2424
options: BelongsToManyOptions<TCreationAttributesThrough, TModelAttributesThrough>
2525
): Function;
2626
export function BelongsToMany<
27-
TCreationAttributes,
28-
TModelAttributes,
29-
TCreationAttributesThrough,
30-
TModelAttributesThrough
27+
TCreationAttributes extends {},
28+
TModelAttributes extends {},
29+
TCreationAttributesThrough extends {},
30+
TModelAttributesThrough extends {}
3131
>(
3232
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
3333
throughOrOptions:

src/associations/belongs-to/belongs-to-association.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { Association } from '../shared/association';
77
import { ModelType } from '../../model/model/model';
88
import { UnionAssociationOptions } from '../shared/union-association-options';
99

10-
export class BelongsToAssociation<TCreationAttributes, TModelAttributes> extends BaseAssociation<
11-
TCreationAttributes,
12-
TModelAttributes
13-
> {
10+
export class BelongsToAssociation<
11+
TCreationAttributes extends {},
12+
TModelAttributes extends {}
13+
> extends BaseAssociation<TCreationAttributes, TModelAttributes> {
1414
constructor(
1515
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
1616
protected options: BelongsToOptions

src/associations/belongs-to/belongs-to.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { BelongsToAssociation } from './belongs-to-association';
44
import { ModelClassGetter } from '../../model/shared/model-class-getter';
55
import { addAssociation, getPreparedAssociationOptions } from '../shared/association-service';
66

7-
export function BelongsTo<TCreationAttributes, TModelAttributes>(
7+
export function BelongsTo<TCreationAttributes extends {}, TModelAttributes extends {}>(
88
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
99
foreignKey?: string
1010
): Function;
1111

12-
export function BelongsTo<TCreationAttributes, TModelAttributes>(
12+
export function BelongsTo<TCreationAttributes extends {}, TModelAttributes extends {}>(
1313
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
1414
options?: BelongsToOptions
1515
): Function;
1616

17-
export function BelongsTo<TCreationAttributes, TModelAttributes>(
17+
export function BelongsTo<TCreationAttributes extends {}, TModelAttributes extends {}>(
1818
associatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
1919
optionsOrForeignKey?: string | BelongsToOptions
2020
): Function {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ModelClassGetter } from '../../model/shared/model-class-getter';
22

3-
export interface ForeignKeyMeta<TCreationAttributes, TModelAttributes> {
3+
export interface ForeignKeyMeta<TCreationAttributes extends {}, TModelAttributes extends {}> {
44
relatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>;
55
foreignKey: string;
66
}

src/associations/foreign-key/foreign-key-service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { ModelType } from '../../model/model/model';
77
const FOREIGN_KEYS_KEY = 'sequelize:foreignKeys';
88

99
export function getForeignKeyOptions<
10-
TCreationAttributes,
11-
TModelAttributes,
12-
TCreationAttributesThrough,
13-
TModelAttributesThrough
10+
TCreationAttributes extends {},
11+
TModelAttributes extends {},
12+
TCreationAttributesThrough extends {},
13+
TModelAttributesThrough extends {}
1414
>(
1515
relatedClass: ModelType<TCreationAttributes, TModelAttributes>,
1616
classWithForeignKey?: ModelType<TCreationAttributesThrough, TModelAttributesThrough>,
@@ -48,7 +48,7 @@ export function getForeignKeyOptions<
4848
/**
4949
* Adds foreign key meta data for specified class
5050
*/
51-
export function addForeignKey<TCreationAttributes, TModelAttributes>(
51+
export function addForeignKey<TCreationAttributes extends {}, TModelAttributes extends {}>(
5252
target: any,
5353
relatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>,
5454
foreignKey: string
@@ -67,7 +67,7 @@ export function addForeignKey<TCreationAttributes, TModelAttributes>(
6767
/**
6868
* Returns foreign key meta data from specified class
6969
*/
70-
export function getForeignKeys<TCreationAttributes, TModelAttributes>(
70+
export function getForeignKeys<TCreationAttributes extends {}, TModelAttributes extends {}>(
7171
target: any
7272
): ForeignKeyMeta<TCreationAttributes, TModelAttributes>[] | undefined {
7373
const foreignKeys = Reflect.getMetadata(FOREIGN_KEYS_KEY, target);

src/associations/foreign-key/foreign-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { addForeignKey } from './foreign-key-service';
22
import { ModelClassGetter } from '../../model/shared/model-class-getter';
33

4-
export function ForeignKey<TCreationAttributes, TModelAttributes>(
4+
export function ForeignKey<TCreationAttributes extends {}, TModelAttributes extends {}>(
55
relatedClassGetter: ModelClassGetter<TCreationAttributes, TModelAttributes>
66
): Function {
77
return (target: any, propertyName: string) => {

0 commit comments

Comments
 (0)