floss.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
For people who care about, support, and build Free, Libre, and Open Source Software (FLOSS).

Administered by:

Server stats:

662
active users

Almost another year has passed and it’s still not possible to use JSDoc and have the TypeScript LSP understand when you’re referring to a class and when you’re referring to an instance…

*sigh*

github.com/jsdoc/jsdoc/issues/

GitHubDocument class types/constructor types · Issue #1349 · jsdoc/jsdocBy tunderdomb
Bart Louwers

@aral I don't understand.

```js
class Base {
bla() {
console.log("base");
}
};

class Derived extends Base {
bla() {
console.log("derived");
}
};

/**
* @template {Base} T
* @param {T} base
*/
function fun(base) {
base.bla();
}

fun(new Base());
fun(new Derived());

/**
*
* @param {typeof Base} cls
*/
function makeBase(cls) {
return new cls();
}

makeBase(Base).bla();
makeBase(Derived).bla();
```

@bart I explained my use case in the linked comment. I don’t see how the use of @template can fix that. (It’s possible I’m missing something.)