Answer the question
In order to leave comments, you need to log in
I can't figure out what this entry means?
I'm starting to learn typeScript, I
came across such code and I just can't google how to understand it
// Need to declare the static model so `findOne` etc. use correct types.
type MyModelStatic = typeof Model & {
new (values?: object, options?: BuildOptions): MyModel;
}
Answer the question
In order to leave comments, you need to log in
I don't really understand what the & sign means.
typeof Model
here it is the type query expression. If you don't understand why typeof can be used here, here's a great explanation , and here's a link to the language specification .new MyModelStatic(values, options)
, this is a construct signature . Pay attention to how exactly the MyModelStatic object is used in my example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question