Got an error, originating from the sequelize type definitions.
node_modules/sequelize-typescript/lib/models/Sequelize.d.ts(7,40):
error TS2507:
Type '{
default: SequelizeStatic;
cls: any;
useCLS(namespace: Namespace): Sequelize;
Utils: Utils;
Prom...'
is not a constructor function type.
Coming from Sequelize.d.ts.
Anyone else getting this error? I'm using typescript 2.7.2 on an Ubuntu machine.
Hey @sanewell92 thanks for reporting. Unfortunately I cannot reproduce the issue. Can you provide an example repo which demonstrates the problem? Thank you
Try cloning this repo and then npm install && npm run build
@sanewell92 thanks for creating the example repo. The compiler option esModuleInterop is causing this error. This is because esModuleInterop: true requires exports like export = to be imported with import target from 'source'. Since the sequelize typings use this format (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/index.d.ts#L6620) it is throwing this error.
So for now, either omit that compiler option (esModuleInterop) or set skipLibCheck: true (see https://www.typescriptlang.org/docs/handbook/compiler-options.html).
But for the long term I will need to investigate this a little bit more and check how I will proceed with this issue.
I've spent a good amount of time dealing with this compilation error of SequelizeOrigin in Sequelize class. Maybe we could add something on the installation instructions about the esModuleInterop option, I'm up for opening a PR if you think it is appropriate @RobinBuschmann.
@junior-ales Sounds good :) For [email protected] this won't be an issue anymore. But for now it is a good idea.
Most helpful comment
@sanewell92 thanks for creating the example repo. The compiler option
esModuleInteropis causing this error. This is becauseesModuleInterop: truerequires exports likeexport =to be imported withimport target from 'source'. Since the sequelize typings use this format (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/index.d.ts#L6620) it is throwing this error.So for now, either omit that compiler option (
esModuleInterop) or setskipLibCheck: true(see https://www.typescriptlang.org/docs/handbook/compiler-options.html).But for the long term I will need to investigate this a little bit more and check how I will proceed with this issue.