Long story short, in javascript "this" refer to the thing-on-the-left-side-of-the-dot. period.
So, when writing ES6 classes & statics methods, use "this" to refer to the static classe.
class User {
static find(criteria) {
//nothing special
var users_ids = sql.search(criteria).select('user_id');
//still good here
users_ids.map( id => return this.instanciate(id) ); //wait what ?
}
static instanciate(id){
return new this(); // this is javascript
}
}
var joes = User.find("user_name LIKE 'joe%'");