CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-flow-remove-types

Fast, zero-configuration Flow type annotation removal tool for JavaScript with CLI and programmatic APIs

84

1.09x
Overview
Eval results
Files

task.mdevals/scenario-8/

Flow Type Stripper

A simple utility that removes Flow interface declarations and type aliases from JavaScript source code.

Requirements

Build a Node.js module that removes Flow type definitions from JavaScript source strings. The tool should:

  1. Accept JavaScript source code as a string
  2. Remove interface declarations (e.g., interface User { name: string })
  3. Remove type alias declarations (e.g., type ID = string | number)
  4. Return the cleaned JavaScript code with all other code preserved

The output should be valid JavaScript that can run in any JavaScript environment, with type definitions removed but functional code intact.

Capabilities

Interface Declaration Removal

  • Given source code with an interface declaration interface Person { name: string; } followed by a function, the module removes only the interface @test
  • Given source code with multiple interface declarations, the module removes all interfaces @test

Type Alias Removal

  • Given source code with a type alias type Status = "active" | "inactive";, the module removes the type alias @test
  • Given source code with a complex type alias like type Handler = (data: string) => void;, the module removes it @test

Mixed Type Definition Removal

  • Given source code with both interfaces and type aliases, the module removes all type definitions @test
  • Given source code where an interface and type alias are used in function annotations, the module removes both the definitions and the annotations @test

Implementation

@generates

API

/**
 * Removes Flow type definitions (interfaces and type aliases) from JavaScript source code
 *
 * @param {string} sourceCode - JavaScript source code containing Flow type annotations
 * @returns {string} Cleaned JavaScript code with type definitions removed
 */
function stripFlowTypes(sourceCode) {
  // Implementation
}

module.exports = { stripFlowTypes };

Dependencies { .dependencies }

flow-remove-types { .dependency }

Provides Flow type annotation removal functionality.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-flow-remove-types

tile.json