WebStorm Live Templates for defining and flow typing Sequelize models
- Copy the text of templates.xml
- Open the WebStorm Preferences
- Go to Live Templates
- Select the JavaScript section
- Paste
- Install
flow-typed
definitions forsequelize
Creates an export default class $MODEL_NAME$ extends Model
declaration.
$MODEL_NAME$
: the name of the model class$INIT_ATTRIBUTES$
: the flow types for attributes required at creation time$ATTRIBUTES$
: the flow types for all other attributes
Make sure to import {Association} from 'sequelize'
when using these.
Expand this template inside of a Model
class definition.
Make sure use the sequelize-imports-bt
template at top level to import the necessary flow types.
$TARGET$
: the name of the association field$SOURCE_MODEL$
: the source model identifier$TARGET_MODEL$
: the target model identifier$PRIMARY_KEY$
: the flow type of the target model's primary key
Expand this template inside of a Model
class definition.
Make sure use the sequelize-imports-h1
template at top level to import the necessary flow types.
$TARGET$
: the name of the association field$SOURCE_MODEL$
: the source model identifier$TARGET_MODEL$
: the target model identifier$PRIMARY_KEY$
: the flow type of the target model's primary key
Expand this template inside of a Model
class definition.
Make sure use the sequelize-imports-hm
template at top level to import the necessary flow types.
$TARGET_SINGULAR$
: the singular name of the association field$TARGET_PLURAL$
: the plural name of the association field$SOURCE_MODEL$
: the source model identifier$TARGET_MODEL$
: the target model identifier$PRIMARY_KEY$
: the flow type of the target model's primary key
Expand this template inside of a Model
class definition.
Make sure use the sequelize-imports-btm
template at top level to import the necessary flow types.
$TARGET_SINGULAR$
: the singular name of the association field$TARGET_PLURAL$
: the plural name of the association field$SOURCE_MODEL$
: the source model identifier$TARGET_MODEL$
: the target model identifier$THROUGH_MODEL$
: the through model identifier$PRIMARY_KEY$
: the flow type of the target model's primary key