When I write the following JavaScript, I get an error: (playground)
/** @template U */
class Bar {
/** @typedef {Partial<U>} MyFoo */
// ^^^--------------- Static members cannot
// reference class type parameters
/** @type {string} */
static someStaticProperty = "hello";
}
Which can be fixed by inserting a dummy property:
/** @template U */
class Bar {
/** @typedef {Partial<U>} MyFoo */
nonStatic = "hello";
/** @type {string} */
static someStaticProperty = "hello";
}
I figured this is probably a bug, so I reported it to the TypeScript team, but it got closed as working as intended. Before I start making a fool of myself and demanding it to get reopened, I figured I'd ask here first:
Is there a relation between @typedef and static properties that warrants this behaviour, or is this a bug?