mockdeep / typewiz

Automatically discover and add missing types in your TypeScript code
https://medium.com/@urish/manual-typing-is-no-fun-introducing-typewiz-58e3e8813f4c
1.1k stars 46 forks source link

Add this typing to functions #33

Closed zoehneto closed 6 years ago

zoehneto commented 6 years ago

In situations where typescript can't infer the type of this in a function (exposed by --noImplicitThis), typewiz should record the this type at runtime and add the relevant type annotation this: someType as the first parameter of the function. To implement this one would have to use the TypeChecker (similarly to #29) with the tryGetThisTypeAt(node) function (this function is not exposed by the interface, see checker.ts for the implementation).