I would like to know how to type node.js fonts in WebStorm models for better code completion.
At least I was able to figure out how to get code completion for model properties. But I do not have model functions from sequelize.
Here is how far I got:
models / exampleModel.js
module.exports = function (sequelize, DataTypes) {
var ExampleModel = sequelize.define('ExampleModel', {
id: {
type: DataTypes.BIGINT.UNSIGNED,
primaryKey: true
},
someProperty: {
type: DataTypes.BOOLEAN,
defaultValue: true
}
}, {
classMethods: {
associate: function (models) {
ExampleModel.belongsTo(models.AnotherModel, {foreignKey: 'id'});
}
}
});
return ExampleModel;
};
models / index.js
'use strict';
var db = {};
module.exports = db;
Now I can type something like
var models = require(__base + 'models');
models.Ex
models.ExampleModel.
and get code completion for models and their properties. Now I miss the continuation methods like "upsert", "create", ...
Does anyone know how to get code completion for the same?
Raalf source
share