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-7/

Flow Declaration Remover

Build a utility that transforms Flow-typed JavaScript by removing type declaration statements while preserving executable code.

Requirements

Create a tool that processes JavaScript source code containing Flow type declarations and outputs clean JavaScript with all declare statements removed.

Core Functionality

Your tool should:

  • Accept JavaScript source code as a string input
  • Remove all Flow declare statements from the code
  • Return the transformed code as a string
  • Preserve all executable JavaScript code unchanged

Test Cases

  • Given input "declare class Logger { }\nconst x = 5;", the output is "const x = 5;" with whitespace preserved @test
  • Given input "declare function process(data: any): number;\nfunction run() { return 1; }", the output contains the run function but no declare statement @test
  • Given input "declare var CONFIG: string;\nvar value = 'test';", the output contains only the value variable @test

Implementation

@generates

API

/**
 * Removes Flow declare statements from JavaScript source code.
 *
 * @param {string} source - The JavaScript source code containing Flow declarations
 * @param {Object} options - Configuration options (optional)
 * @returns {Object} Result object with toString() method
 */
function stripDeclarations(source, options = {}) {
  // Implementation here
}

module.exports = stripDeclarations;

Dependencies { .dependencies }

flow-remove-types { .dependency }

Provides Flow type annotation removal capabilities, including declare statement removal.

@satisfied-by

Install with Tessl CLI

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

tile.json