If you know how to fix the issue, make a pull request instead.
@types/sequelize package and had problems.Definitions by: in index.d.ts) so they can respond.If you do not mention the authors the issue will be ignored.
Issue:
It appears this is out of date. For example, the following code:
import * as Sequelize from "sequelize";
export interface IF_UserAttributes {
name: string;
}
export interface IF_UserInstance extends Sequelize.Instance<IF_UserAttributes>, IF_UserAttributes {
}
produces the following error:
error TS2694: Namespace '".../node_modules/sequelize/types/index"' has no exported member
'Instance'
The same issue occurs if I try to use Sequelize.Models and Sequelize.DataTypes as well. Sequelize.Sequelize is the only one that works for me out of all the ones I've tried.
Here's my dependencies:
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/node": "^7.2.2",
"@babel/preset-env": "^7.4.3",
"@babel/register": "^7.4.0",
"@types/bcrypt": "^3.0.0",
"@types/bluebird": "^3.5.26",
"@types/cors": "^2.8.5",
"@types/dotenv": "^6.1.1",
"@types/express": "^4.16.1",
"@types/graphql": "^14.2.0",
"@types/graphql-resolvers": "^0.2.0",
"@types/ioredis": "^4.0.10",
"@types/jsonwebtoken": "^8.3.2",
"@types/node": "^11.13.7",
"@types/nodemailer": "^4.6.7",
"@types/pg": "^7.4.14",
"@types/sequelize": "^4.27.48",
"@types/validator": "^10.11.0",
"nodemon": "^1.18.11",
"typescript": "^3.4.5"
},
"dependencies": {
"apollo-server": "^2.4.8",
"apollo-server-express": "^2.4.8",
"bcrypt": "^3.0.6",
"cors": "^2.8.5",
"dotenv": "^7.0.0",
"express": "^4.16.4",
"graphql": "^14.2.1",
"graphql-redis-subscriptions": "^2.1.0",
"graphql-resolvers": "^0.3.2",
"ioredis": "^4.9.0",
"jsonwebtoken": "^8.5.1",
"nodemailer": "^6.1.0",
"pg": "^7.9.0",
"sequelize": "^5.5.0"
}
@TidyIQ It appears you're using the 5.x branch of Sequelize, which bundles its own types. The types installed via @types/sequelize are for 4.x. Indeed, it appears the error you listed above references the actual Sequelize package, not your explicitly installed types from this repository.
I would try removing @types/sequelize from your dependencies to see if that solves your issue. If not, I would open an issue with Sequelize directly.
Yep, you're right. I should have checked the version number in the @types/sequelize description. Thanks, problem solved.
I just:
@types/sequelizenode_modules folderyarn install from scratchI keep getting the error on the type:

Currently using v5.7.6
Sequelize.Instance no longer exists in v5
I've been trying to get Sequelize to work with Typescript by following their guides for the last 20 or so hours. I'm giving up. I just installed the sequelize-typescript npm package and will try to get it to work that way instead.
@TidyIQ Did sequelize-typescript work for you? I'm running into this same problem.
Yeah it's working perfectly. It's so much simpler to use and easier to understand when you review your code.
Great! I'll use that!
The simplest thing you could do is to remove sequelize v5 and run yarn add sequelize@4 && yarn add @types/sequelize@4.
The issue has been resolved for me with this solution.
Todd you are a genious you saved my life
Most helpful comment
Yeah it's working perfectly. It's so much simpler to use and easier to understand when you review your code.