anuraghazra / vscode-strip-ts-copy

Strip types from TypeScript code while copying it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strip TS Copy

Strip TS Copy

VSCode plugin to strip types from TypeScript code while copying it.

Visual Studio Marketplace Installs Issues GitHub pull requests

Love the project? Consider sponsoring to help it improve!

Gif demo of strip ts copy

The Problem

"An underdiscussed benefit of JS over TS - I'll frequently test individual functions by pasting them into the browser console. There's no faster feedback loop." - Rich Harris

https://twitter.com/Rich_Harris/status/1440639878065111048

The Solution

strip-ts-copy simply transpiles the selected code and copies it into your clipboard.

Inspired by BenLesh: https://twitter.com/BenLesh/status/1441057916413489156

Usage

  1. Install the plugin from marketplace

  2. Select a piece of code with TS

  3. To copy the transpiled code press:

  • In Windows ctrl+alt+c
  • In Mac shift+alt+cmd+c
  • Or: right click to open the context menu and select "Copy TS as JS"

Note: You can also customize the keybindings of StripTSCopy from the keyboard shortcuts customizer page in vscode.

Local development

  1. Clone the repo
  2. Install deps
  3. Open Run & Debug (Ctrl+Shift+D) panel in vscode and hit start debugging button

TODO

  • Write tests
  • Setup release pipeline

About

Strip types from TypeScript code while copying it.


Languages

Language:TypeScript 100.0%