Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code's Intellisense does not suggest any functions of a Sequelize object in Node.js?

When following the Sequelize's document, I created User model by using the sequelize object.

const Sequelize = require("sequelize");

const Model = Sequelize.Model;
const path = "mysql://user:password@localhost:3306/test_db";

const sequelize = new Sequelize(path, {
  pool: {
    max: 5,
    min: 0,
    acquire: 30000,
    idle: 10000
  }
});

const User = sequelize.define('user', {
  firstName: {
    type: Sequelize.STRING,
    allowNull: false
  },
  lastName: {
    type: Sequelize.STRING
  }
}, {});

The code runs fine but the problem is the Intellisense from the VS Code did not suggest any functions from the sequelize object like this :

this

Is this a kind of bug or do I code something wrong?

like image 684
Kiro Hikaru Avatar asked Nov 28 '25 23:11

Kiro Hikaru


1 Answers

Just import Sequelize to your utility file with curly brackets

const { Sequelize } = require('sequelize');
like image 75
relbns Avatar answered Dec 01 '25 23:12

relbns