-
Notifications
You must be signed in to change notification settings - Fork 286
Closed
Description
Issue
Sequelize-Typescript v6.6.4 issue in clean Project
Versions
- sequelize: 6.6.4
- sequelize-typescript: 2.1.0
- typescript: 4.2.3
Issue type
- [x ] bug report
- feature request
Actual behavior
I get the following error:
node_modules/sequelize-typescript/dist/model/model/model.d.ts:10:31 - error TS2417: Class static side 'typeof import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize-typescript/dist/model/model/model").Model' incorrectly extends base class static side 'typeof import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize/types/lib/model").Model'.
The types returned by 'init(...)' are incompatible between these types.
Type 'Model<any, any>' is not assignable to type 'MS'.
'MS' could be instantiated with an arbitrary type which could be unrelated to 'Model<any, any>'.
10 export declare abstract class Model<TModelAttributes extends {} = any, TCreationAttributes extends {} = TModelAttributes> extends OriginModel<TModelAttributes, TCreationAttributes> {
node_modules/sequelize-typescript/dist/sequelize/sequelize/sequelize.d.ts:12:5 - error TS2416: Property 'model' in type 'Sequelize' is not assignable to the same property in base type 'Sequelize'.
Type '<TCreationAttributes, TModelAttributes>(model: string | ModelType<TCreationAttributes, TModelAttributes>) => ModelCtor<Model<any, any>>' is not assignable to type '(modelName: string) => ModelCtor<Model<any, any>>'.
Type 'import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize-typescript/dist/model/model/model").ModelCtor<import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize-typescript/dist/model/model/model").Model<any, any>>' is not assignable to type 'import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize/types/lib/model").ModelCtor<import("/Users/iansamz/Projects/iik/iik-api-v2/node_modules/sequelize/types/lib/model").Model<any, any>>'.
Type 'ModelCtor<Model<any, any>>' is not assignable to type 'typeof Model'.
The types returned by 'init(...)' are incompatible between these types.
Type 'Model<any, any>' is not assignable to type 'MS'.
'MS' could be instantiated with an arbitrary type which could be unrelated to 'Model<any, any>'.
model<TCreationAttributes, TModelAttributes>(model: string | ModelType<TCreationAttributes, TModelAttributes>): ModelCtor;
Expected behavior
I expect a successful compilation
Steps to reproduce
nest new project-name
npm install --save @nestjs/sequelize sequelize sequelize-typescript mysql2
npm install --save-dev @types/sequelize
Then the app.module.ts
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { SequelizeModule } from '@nestjs/sequelize';
@Module({
imports: [
SequelizeModule.forRoot({
dialect: 'mysql',
host: 'localhost',
port: 3306,
username: 'root',
password: 'root',
database: 'test',
models: [],
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Related code
My Package.json
{
"name": "iik-api-v2",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"dev": "nest start --watch",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^7.6.15",
"@nestjs/config": "^0.6.3",
"@nestjs/core": "^7.6.15",
"@nestjs/platform-express": "^7.6.15",
"@nestjs/sequelize": "^0.2.0",
"dotenv": "^10.0.0",
"mysql2": "^2.2.5",
"pg": "^8.6.0",
"pg-hstore": "^2.3.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.6.6",
"sequelize": "^6.6.4",
"sequelize-typescript": "^2.1.0"
},
"devDependencies": {
"@nestjs/cli": "^7.6.0",
"@nestjs/schematics": "^7.3.0",
"@nestjs/testing": "^7.6.15",
"@types/express": "^4.17.11",
"@types/jest": "^26.0.22",
"@types/node": "^15.12.5",
"@types/sequelize": "^4.28.9",
"@types/supertest": "^2.0.10",
"@types/validator": "^13.1.4",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"supertest": "^6.1.3",
"ts-jest": "^26.5.4",
"ts-loader": "^8.0.18",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.2.3"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
jessemyers, VictoriqueMoe, sujansaresta, negezor, flamewow and 6 more
Metadata
Metadata
Assignees
Labels
No labels