Skip to content

Typescript 4.5.4 does not like sequelize-ESM imports in v6.12 #13791

@dilyanpalauzov

Description

@dilyanpalauzov

My understanding of #13689, included in v6.12 is, that sequelize is not any more exported just in CommonJS, but can be used also as ESM-imports. Thus, the code in v6.11

import sequelize_ from 'sequelize'
const {DataTypes, Model, Op} = sequelize_ //this is CommonJS hack

can be changed in 6.12 to import {DataTypes, Model, Op} from 'sequelize'.

Typescript 4.5.4 fails on the above code with

$ node_modules/.bin/tsc
node_modules/sequelize/lib/operators.ts:524:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.

524 export = Op;
    ~~~~~~~~~~~~

Found 1 error.

My understanding is, that Typescript is only supposed to verify the types in sequelize by parsing the code in the node_modules/sequelize/types directory, and not loose time to verify each file in node_modules/sequelize/lib/. But types/index.d.ts contains import * as Op from "../lib/operators"; so my assumption is not correct. Likewise for node_modules/sequelize/types/lib/model.d.ts:import * as Op from '../../lib/operators';

Bug Report Checklist

How does this problem relate to dialects?

  • I think this problem happens regardless of the dialect.

Would you be willing to resolve this issue by submitting a Pull Request?

  • No, I don't have the time and I wouldn't even know how to start.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions