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.

model type can not be infer because of the lack of @types/bluebird

See original GitHub issue

What are you doing?

I am using sequelize with typescript. Below is my demo file

// code here
import {Sequelize, Model, STRING, DATE} from 'sequelize'
const sequelize = new Sequelize('postgres://user:pass@example.com:5432/dbname');

class User extends Model {}
User.init({
  username: STRING,
  birthday: DATE
}, { sequelize });

User.create({
  username: 'janedoe',
  birthday: new Date(1980, 6, 20)
}).then(vvvv => {

})

What do you expect to happen?

vvvv should be infer to type User, but it doesn’t.

What is actually happening?

vvvv is infer to any.

when I run npm i @types/bluebird, the infer works.

Dialect: any Dialect version: any Database version: any Sequelize version: 5.2.7 Tested with latest release: Yes. 5.2.7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
alsotangcommented, Mar 31, 2019

When I crll+F typescirpt in README. I only found this url: https://github.com/RobinBuschmann/sequelize-typescript

According to https://github.com/RobinBuschmann/sequelize-typescript/issues/587#issuecomment-478332149 . You have a typescript guide here: http://docs.sequelizejs.com/manual/typescript.html . So if make it obvious, it would be nice.

0reactions
sushantdhimancommented, Apr 3, 2019

🎉 This issue has been resolved in version 5.2.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems inferring type with typescript - Stack Overflow
There is currently are less than intuitive ways to get Bluebird promises to override the global Promise that TypeScript provides.
Read more >
Does type inference renders the code less readable - Reddit
Yes and no. A good IDE for a type-inferred language can display the types of variables automatically, so that the type of the...
Read more >
gitignore and change to database (ea03ea61) · Commits ... - GitLab
Alias for `router.delete()` because delete is a reserved word ... the return type propagation of generators to automatically infer the return type T....
Read more >
licenses_clients_v23.txt - Pexip Infinity Docs
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ......
Read more >
Dependencies | ozone-item-preview | npm | Open Source Insights
Errors found while resolving dependencies: could not find a version that satisfies requirement git+https://git@bitbucket.taktik.be/scm/sandbox/ozone-type.git ...
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