Let's say, I have two models User and Post, and they are associated as one to many relationship:
const User = sequelize.define('user', {
...
});
const Post = sequelize.define('post', {
...
});
User.hasMany(Post);
Then if I get some posts from a user using getPosts method,
const user = await User.findOne({...});
const posts = await user.getPosts();
^^^^^^^^
Typescript makes an error:
error TS2339: Property 'getPosts' does not exist on type '{}'.
What should I do for it? Any suggestions will be appreciated.