Consider the following code snippet:
class Test{
/** @type {(e : Event)=> void} */ test;
}
var test2 = new Test();
test2.test = (e) => {}
If you were to use this code in a program like VS Code, you will observe that the variable e
in the last line is assigned the type any
.
I am determined to address this issue by creating my own plugin or extension for TypeScript, specifically for applications like VS Code. I have extensively studied resources on language services, language servers, as well as extensions for both VS Code and TypeScript.
My objective: I simply aim to enable "noImplicitAny" and if feasible, even "noExplicitAny" across my entire project. However, I am currently unable to do so because whenever I explicitly define an HTML event argument within an expression body, it defaults to type any. This means I would need to tediously cast each event argument to a specific type in order to achieve proper inference, resulting in numerous lines of additional code.
It surprises me that there isn't an existing plugin available with this functionality integrated, at least from what I know.