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

Flow Type Transformer with Source Maps

Build a tool that transforms Flow-typed JavaScript files by removing type annotations and generating source maps for debugging.

Requirements

Your tool should accept Flow-typed JavaScript source code and produce two outputs:

  1. The transformed JavaScript code with type annotations removed
  2. A v3 format source map that maps the transformed code back to the original source

The transformation should completely remove type annotations rather than replacing them with whitespace, producing clean output suitable for production deployment.

Test Cases

  • Given Flow code with function parameter types, the transformer removes the type annotations and generates a valid source map @test
  • Given Flow code with multiple type constructs (return types, variable types, type imports), the transformer produces both clean JavaScript and an accurate source map @test
  • The generated source map follows the v3 format specification with proper structure @test

Implementation

@generates

API

/**
 * Transforms Flow-typed JavaScript source code by removing type annotations
 * and generating a source map.
 *
 * @param {string} sourceCode - The Flow-typed JavaScript source code
 * @returns {Object} An object with two properties:
 *   - code: The transformed JavaScript as a string
 *   - sourceMap: The v3 format source map object
 */
function transformWithSourceMap(sourceCode) {
  // IMPLEMENTATION HERE
}

module.exports = { transformWithSourceMap };

Dependencies { .dependencies }

flow-remove-types { .dependency }

Provides Flow type annotation removal with source map generation support.

Install with Tessl CLI

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

tile.json