npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

typegone

v1.2.2

Published

Convert TypeScript to plain JavaScript by stripping all types and JSDoc annotations.

Downloads

135

Readme

🧨 typegone

NPM Version NPM Downloads

Build Status codecov

TypeScript is just JavaScript in a cosplay. typegone makes it real again.

typegone is a source-to-source transformer tool that replaces all TypeScript type annotations with any, or removes them entirely, including types from JSDoc — effectively turning your TypeScript back into plain JavaScript.

It can also add any to untyped JavaScript parameters, effectively converting plain JS to TypeScript with any everywhere.


🚀 Features

  • ✅ Replace all existing type annotations (: string, : number, etc.) with any
  • ✅ Add : any to untyped function parameters
  • ✅ Convert as Something to as any
  • ✅ Remove generics like <T>
  • ✅ Convert or remove JSDoc {type} annotations
  • ✅ Optionally remove all type annotations entirely (turn TypeScript into pure JavaScript)
  • ✅ Support file-based config (typegone.config.js)
  • Non-destructive: Only types are removed, logic stays the same

🔧 Usage

1. Install

npm install -D typegone

2. Configuration - Create a typegone.config.* file

TypeGone will automatically detect a configuration file named typegone.config with one of the following extensions:

  • .ts, .js, .cjs, .mjs

📍 Important: This file must be located at the root of your project (next to your package.json).

For example:

  • typegone.config.ts
  • typegone.config.js
  • typegone.config.cjs
  • typegone.config.mjs

You can define your config using either:

  • A plain object
  • Or with the helper defineTypegoneConfig (recommended for better DX in TypeScript)

✅ Example: typegone.config.js (ESM)

Using defineTypegoneConfig (recommended)
import { defineTypegoneConfig } from "typegone";

export default defineTypegoneConfig({
  include: ["src/**/*.{ts,tsx}"],
  exclude: ["**/node_modules/**", "**/dist/**"],
  overwrite: false,
  outDir: "./typegone",             // Output folder with same structure
  convertJsDoc: true,           // Convert `{string}` → `{any}` in JSDoc
  removeJsDocType: false        // If true, remove all JSDoc types entirely
});
Or just a plain object (works too)
export default {
  include: ["src/**/*.{ts,tsx}"],
  exclude: ["**/node_modules/**", "**/dist/**"]
};

✅ Example: typegone.config.cjs (CommonJS)

Using defineTypegoneConfig
const { defineTypegoneConfig } = require("typegone");

module.exports = defineTypegoneConfig({
  include: ["src/**/*.{ts,js}"],
  exclude: ["**/node_modules/**", "**/dist/**"]
});
Or plain object export
module.exports = {
  include: ["src/**/*.{ts,tsx}"],
  exclude: ["**/node_modules/**", "**/dist/**"]
};

3. Run it

npx typegone

It will auto-detect your config file and apply transformations.


🧪 Example

Before:

interface User {
  name: string;
  age: number;
}

/**
 * @param {string} name
 * @returns {number}
 */
function greet(name: string): number {
  return name.length;
}

After:

interface User {
  name: any;
  age: any;
}

/**
 * @param {any} name
 * @returns {any}
 */
function greet(name: any): any {
  return name.length;
}

⚙️ Configuration Options

| Option | Type | Description | |--------------------|-----------|------------------------------------------------------------------------------| | include | string[] | Glob patterns to include (default: src/**/*.{ts,tsx}) | | exclude | string[] | Glob patterns to exclude | | overwrite | boolean | Overwrite original files with modified ones (use with caution) | | verbose | boolean | Log each file being changed | | convertJsDoc | boolean | Replace JSDoc {type} with {any} | | removeJsDocType | boolean | Remove all JSDoc comments that declare types (e.g. @param, @returns) | | stripTypes | boolean | Remove all type annotations instead of replacing them with any | | outDir | string | Output directory. Files will be written here with the same folder structure |


🤔 Why would you use this?

  • Migrate a legacy JavaScript project to TypeScript with permissive any everywhere (for gradual typing).
  • Convert a TypeScript codebase back to plain JavaScript for faster prototyping or delivery.
  • Strip types before bundling or passing code to tools that don't support TypeScript.
  • Generate raw, untyped output for AI models, code analysis, or codegen pipelines.
  • Or just troll your teammates on a Friday. (Use at your own risk)

📦 Changelog

See full release notes in CHANGELOG.md


📄 License

MIT © 2025 — Made with ❤️ by @yukiakai