Skip to content

Commit 6c5a82d

Browse files
renovate[bot]ephys
andauthored
fix: update typescript to v5.8.2 (#17728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alyx <[email protected]>
1 parent dd587cb commit 6c5a82d

27 files changed

+161
-155
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
strategy:
157157
fail-fast: false
158158
matrix:
159-
ts-version: ['5.1', '5.2', '5.3', '5.4']
159+
ts-version: ['5.5', '5.6', '5.7', '5.8']
160160
name: TS Typings (${{ matrix.ts-version }})
161161
runs-on: ubuntu-latest
162162
needs: lint

package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,10 @@
9595
"prettier-plugin-organize-imports": "4.1.0",
9696
"source-map-support": "0.5.21",
9797
"ts-node": "10.9.2",
98-
"typedoc": "0.25.13",
99-
"typedoc-plugin-carbon-ads": "1.6.0",
100-
"typedoc-plugin-mdn-links": "3.3.8",
101-
"typedoc-plugin-missing-exports": "2.3.0",
102-
"typescript": "5.4.5"
98+
"typedoc": "0.27.9",
99+
"typedoc-plugin-mdn-links": "5.0.1",
100+
"typedoc-plugin-missing-exports": "3.1.0",
101+
"typescript": "5.8.2"
103102
},
104103
"packageManager": "[email protected]",
105104
"lint-staged": {

packages/core/src/abstract-dialect/query-generator-typescript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export interface EscapeOptions extends FormatWhereOptions {
132132

133133
export interface FormatWhereOptions extends Bindable {
134134
/**
135-
* These are used to inline replacements into the query, when one is found inside of a {@link Literal}.
135+
* These are used to inline replacements into the query, when one is found inside of a {@link sql.literal}.
136136
*/
137137
readonly replacements?: BindOrReplacements | undefined;
138138

packages/core/src/abstract-dialect/query-generator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ export class AbstractQueryGenerator extends AbstractQueryGeneratorTypeScript {
942942
*
943943
* ⚠️ You almost certainly want to use `quoteIdentifier` instead!
944944
* This method splits the identifier by "." into multiple identifiers, and has special meaning for "*".
945-
* This behavior should never be the default and should be explicitly opted into by using {@link Col}.
945+
* This behavior should never be the default and should be explicitly opted into by using {@link sql.col}.
946946
*
947947
* @param {string} identifiers
948948
*

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class BelongsToManyAssociation<
131131
/**
132132
* The name of the Foreign Key attribute, located on the through table, that points to the Target model.
133133
*
134-
* Not to be confused with @link {BelongsToMany.foreignKey}, which points to the Source model instead.
134+
* Not to be confused with {@link BelongsToManyAssociation#foreignKey}, which points to the Source model instead.
135135
*/
136136
get otherKey(): string {
137137
return this.pairedWith.foreignKey;

packages/core/src/decorators/legacy/validation.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ export const ValidateAttribute = createRequiredAttributeOptionsDecorator<ColumnV
4040
* @example
4141
* ```ts
4242
* class User extends Model {
43-
* @ValidateModel
43+
* @ModelValidator
4444
* onValidate() {
4545
* if (this.name !== VALID_NAME) {
4646
* throw new Error(ERROR_MESSAGE);
4747
* }
4848
* }
4949
*
50-
* @ValidateModel
50+
* @ModelValidator
5151
* static onValidate(instance) {
5252
* if (instance.name !== VALID_NAME) {
5353
* throw new Error(ERROR_MESSAGE);

packages/core/src/decorators/shared/model.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function mergeAttributeOptions(
112112
// These are objects. We merge their properties, unless the same key is used in both values.
113113
if (optionName === 'validate') {
114114
for (const [subOptionName, subOptionValue] of getAllOwnEntries(optionValue)) {
115-
if (subOptionName in existingOptions[optionName]! && !overrideOnConflict) {
115+
if (subOptionName in existingOptions[optionName] && !overrideOnConflict) {
116116
throw new Error(
117117
`Multiple decorators are attempting to register option ${optionName}[${JSON.stringify(subOptionName)}] of attribute ${attributeName} on model ${model.name}.`,
118118
);
@@ -134,7 +134,8 @@ export function mergeAttributeOptions(
134134
}
135135

136136
if (Array.isArray(optionValue)) {
137-
// @ts-expect-error -- runtime type checking is enforced by model
137+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- became valid in TS 5.8
138+
// @ts-ignore -- runtime type checking is enforced by model
138139
existingOptions[optionName] = [...existingOptions[optionName], ...optionValue];
139140
} else {
140141
existingOptions[optionName] = [...existingOptions[optionName], optionValue];

packages/core/src/expression-builders/attribute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { DialectAwareFn } from './dialect-aware-fn.js';
66
import type { JsonPath } from './json-path.js';
77

88
/**
9-
* Use {@link attribute} instead.
9+
* Use {@link sql.attribute} instead.
1010
*/
1111
export class Attribute extends BaseSqlExpression {
1212
declare protected readonly [SQL_IDENTIFIER]: 'attribute';

packages/core/src/expression-builders/cast.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
66
import { where } from './where.js';
77

88
/**
9-
* Do not use me directly. Use {@link cast}
9+
* Do not use me directly. Use {@link sql.cast}
1010
*/
1111
export class Cast extends BaseSqlExpression {
1212
declare protected readonly [SQL_IDENTIFIER]: 'cast';

packages/core/src/expression-builders/col.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
22

33
/**
4-
* Do not use me directly. Use {@link col}
4+
* Do not use me directly. Use {@link sql.col}
55
*/
66
export class Col extends BaseSqlExpression {
77
declare protected readonly [SQL_IDENTIFIER]: 'col';
@@ -18,11 +18,11 @@ export class Col extends BaseSqlExpression {
1818

1919
/**
2020
* Creates an object which represents a column in the DB, this allows referencing another column in your query.
21-
* This is often useful in conjunction with {@link fn}, {@link where} and {@link sql} which interpret strings as values and not column names.
21+
* This is often useful in conjunction with {@link sql.fn}, {@link sql.where} and {@link sql} which interpret strings as values and not column names.
2222
*
23-
* Col works similarly to {@link Identifier}, but "*" has special meaning, for backwards compatibility.
23+
* Col works similarly to {@link sql.identifier}, but "*" has special meaning, for backwards compatibility.
2424
*
25-
* ⚠️ We recommend using {@link Identifier}, or {@link Attribute} instead.
25+
* ⚠️ We recommend using {@link sql.identifier}, or {@link sql.attribute} instead.
2626
*
2727
* @param identifiers The name of the column
2828
*/

packages/core/src/expression-builders/dialect-aware-fn.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { BaseSqlExpression } from './base-sql-expression.js';
66
import { JsonPath } from './json-path.js';
77

88
/**
9-
* Unlike {@link Fn}, this class does not accept a function name.
9+
* Unlike {@link sql.fn}, this class does not accept a function name.
1010
* It must instead be extended by a class that implements the {@link applyForDialect} method, in which
1111
* the function name is provided.
1212
*

packages/core/src/expression-builders/fn.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
55
import { where } from './where.js';
66

77
/**
8-
* Do not use me directly. Use {@link fn}
8+
* Do not use me directly. Use {@link sql.fn}
99
*/
1010
export class Fn extends BaseSqlExpression {
1111
declare protected readonly [SQL_IDENTIFIER]: 'fn';
@@ -22,7 +22,7 @@ export class Fn extends BaseSqlExpression {
2222

2323
/**
2424
* Creates an object representing a database function. This can be used in search queries, both in where and order parts, and as default values in column definitions.
25-
* If you want to refer to columns in your function, you should use {@link Attribute} (recommended), {@link Identifier}, or {@link col} (discouraged)
25+
* If you want to refer to columns in your function, you should use {@link sql.attribute} (recommended), {@link sql.identifier}, or {@link sql.col} (discouraged)
2626
* otherwise the value will be interpreted as a string.
2727
*
2828
* ℹ️ This method is usually verbose and we recommend using the {@link sql} template string tag instead.

packages/core/src/expression-builders/identifier.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { TableOrModel } from '../abstract-dialect/query-generator.types';
22
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
33

44
/**
5-
* Use {@link identifier} instead.
5+
* Use {@link sql.identifier} instead.
66
*/
77
export class Identifier extends BaseSqlExpression {
88
declare protected readonly [SQL_IDENTIFIER]: 'identifier';
@@ -14,7 +14,7 @@ export class Identifier extends BaseSqlExpression {
1414

1515
/**
1616
* Used to represent a value that will either be escaped to a literal, or a bind parameter.
17-
* Unlike {@link attribute} and {@link col}, this identifier will be escaped as-is,
17+
* Unlike {@link sql.attribute} and {@link sql.col}, this identifier will be escaped as-is,
1818
* without mapping to a column name or any other transformation.
1919
*
2020
* This method supports strings, table structures, model classes (in which case the identifiers will be the model schema & table name), and model definitions (same behavior as model classes)

packages/core/src/expression-builders/json-path.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Expression } from '../sequelize.js';
22
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
33

44
/**
5-
* Do not use me directly. Use {@link jsonPath}.
5+
* Do not use me directly. Use {@link sql.jsonPath}.
66
*/
77
export class JsonPath extends BaseSqlExpression {
88
declare protected readonly [SQL_IDENTIFIER]: 'jsonPath';
@@ -17,7 +17,7 @@ export class JsonPath extends BaseSqlExpression {
1717

1818
/**
1919
* Use this to access nested properties in a JSON column.
20-
* You can also use the dot notation with {@link Attribute}, but this works with any values, not just attributes.
20+
* You can also use the dot notation with {@link sql.attribute}, but this works with any values, not just attributes.
2121
*
2222
* @param expression The expression to access the property on.
2323
* @param path The path to the property. If a number is used, it will be treated as an array index, otherwise as a key.

packages/core/src/expression-builders/list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
22

33
/**
4-
* Use {@link list} instead.
4+
* Use {@link sql.list} instead.
55
*/
66
export class List extends BaseSqlExpression {
77
declare protected readonly [SQL_IDENTIFIER]: 'list';

packages/core/src/expression-builders/literal.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
22

33
/**
4-
* Do not use me directly. Use {@link literal}
4+
* Do not use me directly. Use {@link sql.literal}
55
*/
66
export class Literal extends BaseSqlExpression {
77
declare protected readonly [SQL_IDENTIFIER]: 'literal';

packages/core/src/expression-builders/sql.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Value } from './value.js';
1414
import { where } from './where.js';
1515

1616
/**
17-
* The template tag function used to easily create {@link literal}.
17+
* The template tag function used to easily create {@link sql.literal}.
1818
*
1919
* @param rawSql
2020
* @param values

packages/core/src/expression-builders/where.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Expression } from '../sequelize.js';
99
import { BaseSqlExpression, SQL_IDENTIFIER } from './base-sql-expression.js';
1010

1111
/**
12-
* Do not use me directly. Use {@link where}
12+
* Do not use me directly. Use {@link sql.where}
1313
*/
1414
export class Where<Operator extends keyof WhereOperators = typeof Op.eq> extends BaseSqlExpression {
1515
declare protected readonly [SQL_IDENTIFIER]: 'where';
@@ -78,7 +78,7 @@ If you wish to use custom operators not provided by Sequelize, you can use the "
7878
* A way of writing an SQL binary operator, or more complex where conditions.
7979
*
8080
* This solution is slightly more verbose than the POJO syntax, but allows any value on the left hand side of the operator (unlike the POJO syntax which only accepts attribute names).
81-
* For instance, either the left or right hand side of the operator can be {@link fn}, {@link col}, {@link literal} etc.
81+
* For instance, either the left or right hand side of the operator can be {@link sql.fn}, {@link sql.col}, {@link sql.literal} etc.
8282
*
8383
* If your left operand is an attribute name, using the regular POJO syntax (`{ where: { attrName: value }}`) syntax is usually more convenient.
8484
*

packages/core/src/model-definition.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ export function mergeModelOptions<M extends Model>(
982982
continue;
983983
}
984984

985-
if (!overrideOnConflict && subOptionName in existingModelOptions[optionName]!) {
985+
if (!overrideOnConflict && subOptionName in existingModelOptions[optionName]) {
986986
throw new Error(
987987
`Trying to set the option ${optionName}[${JSON.stringify(subOptionName)}], but a value already exists.`,
988988
);
@@ -1009,7 +1009,8 @@ export function mergeModelOptions<M extends Model>(
10091009
: [existingHooks[hookType]];
10101010

10111011
if (!Array.isArray(optionValue[hookType])) {
1012-
// @ts-expect-error -- typescript doesn't like this merge algorithm.
1012+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- became valid in TS 5.8
1013+
// @ts-ignore -- typescript doesn't like this merge algorithm.
10131014
existingHooks[hookType] = [...existingHooksOfType, optionValue[hookType]];
10141015
} else {
10151016
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- This error only occurs on TS 5.3+

packages/core/src/model.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export interface Transactionable {
8484
* Internal only
8585
*
8686
* @private
87+
* @hidden
8788
*/
8889
[COMPLETES_TRANSACTION]?: boolean | undefined;
8990
}
@@ -1757,7 +1758,7 @@ export interface AttributeOptions<M extends Model = Model> {
17571758
columnName?: string | undefined;
17581759

17591760
/**
1760-
* A literal default value, a JavaScript function, or an SQL function (using {@link fn})
1761+
* A literal default value, a JavaScript function, or an SQL function (using {@link sql.fn})
17611762
*/
17621763
defaultValue?: unknown | undefined;
17631764

packages/core/src/sequelize-typescript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ Connection options can be used at the root of the option bag, in the "replicatio
805805
/**
806806
* Escape value to be used in raw SQL.
807807
*
808-
* If you are using this to use the value in a {@link literal}, consider using {@link sql} instead, which automatically
808+
* If you are using this to use the value in a {@link sql.literal}, consider using {@link sql} instead, which automatically
809809
* escapes interpolated values.
810810
*
811811
* @param value The value to escape

packages/core/src/sequelize.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ export class Sequelize<
240240
* @param fn The function you want to call
241241
* @param args All further arguments will be passed as arguments to the function
242242
*
243-
* @deprecated use top level {@link fn} instead
243+
* @deprecated use top level {@link sql.fn} instead
244244
* @hidden
245245
*/
246246
static fn: typeof fn;
247247
/**
248-
* @deprecated use top level {@link fn} instead
248+
* @deprecated use top level {@link sql.fn} instead
249249
* @hidden
250250
*/
251251
fn: typeof fn;
@@ -256,12 +256,12 @@ export class Sequelize<
256256
*
257257
* @param col The name of the column
258258
*
259-
* @deprecated use top level {@link col} instead
259+
* @deprecated use top level {@link sql.col} instead
260260
* @hidden
261261
*/
262262
static col: typeof col;
263263
/**
264-
* @deprecated use top level {@link col} instead
264+
* @deprecated use top level {@link sql.col} instead
265265
* @hidden
266266
*/
267267
col: typeof col;
@@ -287,12 +287,12 @@ export class Sequelize<
287287
*
288288
* @param val
289289
*
290-
* @deprecated use top level {@link literal} instead
290+
* @deprecated use top level {@link sql.literal} instead
291291
* @hidden
292292
*/
293293
static literal: typeof literal;
294294
/**
295-
* @deprecated use top level {@link literal} instead
295+
* @deprecated use top level {@link sql.literal} instead
296296
* @hidden
297297
*/
298298
literal: typeof literal;

packages/core/test/integration/data-types/data-types.test.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ describe('DataTypes', () => {
15451545
describe('BLOB', () => {
15461546
const vars = beforeAll2(async () => {
15471547
class User extends Model<InferAttributes<User>> {
1548-
declare attr: ArrayBuffer | string | Blob;
1548+
declare attr: ArrayBuffer | string | Buffer | Uint8Array;
15491549
}
15501550

15511551
User.init(
@@ -1589,6 +1589,8 @@ describe('DataTypes', () => {
15891589
it('rejects Blobs & non-Uint8Array ArrayBufferViews', async () => {
15901590
await expect(
15911591
vars.User.create({
1592+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- error only appears in TS 5.5+
1593+
// @ts-ignore -- intentionally testing invalid input
15921594
attr: new Blob(['abcd']),
15931595
}),
15941596
).to.be.rejectedWith(
@@ -1598,6 +1600,8 @@ describe('DataTypes', () => {
15981600

15991601
await expect(
16001602
vars.User.create({
1603+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- error only appears in TS 5.5+
1604+
// @ts-ignore -- intentionally testing invalid input
16011605
attr: new Uint16Array([49, 50, 51, 52]),
16021606
}),
16031607
).to.be.rejectedWith(

0 commit comments

Comments
 (0)