@mkmod-ts/ts-inject-this-type
v1.0.0
Published
Uses `typescript` to set the type of `this` in a function:
Readme
@mkmod-ts/ts-inject-this-type
Uses typescript to set the type of this in a function:
const injectThisType = require("@mkmod-ts/ts-inject-this-type")
const code = `
export function foo() {
}
`
console.log(
injectThisType(code, "foo", "FooThisType")
)Returns null if this was not injected otherwise code with injected this:
export function foo(this: FooThisType) {
}