Fast, zero-configuration Flow type annotation removal tool for JavaScript with CLI and programmatic APIs
84
Build a tool that removes Flow type annotations from JavaScript class definitions while preserving the runtime behavior.
Your implementation should:
implements clausesInput: A string containing Flow-typed JavaScript code with class definitions
Output: A string containing the same code with class type features removed
Input:
class Container<T> implements Storage {
items: T[];
count: number = 0;
constructor() {
this.items = [];
}
}Expected output:
class Container {
items;
count = 0;
constructor() {
this.items = [];
}
}Input:
class Base<T> {
value: T;
}
class Derived<U> extends Base<U> implements Validator {
valid: boolean = true;
}Expected output:
class Base {
value;
}
class Derived extends Base {
valid = true;
}@generates
/**
* Removes Flow type features from class definitions in JavaScript source code.
*
* @param {string} source - JavaScript source code containing Flow-typed classes
* @returns {string} The transformed JavaScript with class type features removed
*/
function stripClassTypes(source) {
// IMPLEMENTATION HERE
}
module.exports = { stripClassTypes };Provides Flow type annotation removal functionality.
Install with Tessl CLI
npx tessl i tessl/npm-flow-remove-typesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10