ts-migrate-example
is a basic example of usage of the ts-migrate-server with writing a custom plugin.
-
example-plugin-jscodeshift simply reverses the names of all identifiers.
-
example-plugin-text will add a
console.log
before each return statement. -
example-plugin-ts is a simple TypeScript AST-based plugin, which shows how we can add simple types to the JavaScript code with the usage of TypeScript compiler API.
We're using the following input:
function mult(first, second) {
return first * second;
}
and with a config of 3 simple plugins, produce the output:
function tlum(tsrif: number, dnoces: number): number {
console.log(`args: ${arguments}`)
return tsrif * dnoces;
}
You can read about codemods here and browse ts-migrate repository for additional examples and tests.
Please file the issue here.
See the Contributors Guide.