1.0.0 • Published 3 years ago

@mkmod-ts/ts-inject-this-type v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@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) {

}