question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sequelize constructor

See original GitHub issue

Hey! I have a (maybe) stupid question about the type definition for sequelize. I’m using

const Sequelize = require('sequelize');
const sequelize = new Sequelize(
  config.database,
  config.username,
  config.password,
  config
);

Flow do read the type definition and if I type Sequelize. I get an autocomplete with a bunch of options. But flow doesn’t think Sequelize is a function. I don’t know if this is because the typedef is wrong or if I’m doing something wrong. This is the flow error I get: [flow] Cannot call `Sequelize` because module `sequelize` [1] is not a function. (References: [1])

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gugucommented, Jun 29, 2018

if I replace export default class Sequelize by export class Sequelize and change code const { Sequelize} = require('sequelize'); it works

0reactions
jedwards1211commented, Sep 12, 2019

I see, huh, I haven’t seen a situation where it was that difficult to add Babel into an existing project…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - Sequelize
The Sequelize constructor accepts a lot of options. They are documented in the API Reference. Testing the connection​.
Read more >
Static Method Summary - Sequelize
constructor (database: string, username: string, password: string, options: object). Instantiate sequelize with name of database, username and password.
Read more >
Dialect-Specific Things - Sequelize
dialectOptions are passed directly to the MariaDB connection constructor. A full list of options can be found in the MariaDB docs. SQLite​. The ......
Read more >
Model Instances - Sequelize
As you already know, a model is an ES6 class. An instance of the class represents one object from that model (which maps...
Read more >
Options | @sequelize/core
Options for the constructor of the Sequelize main class. Hierarchy. Logging. Options. Defined in types/sequelize.d.ts: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found