Skip to content

Repository files navigation

Shareable Twoslash Comments

A TypeScript Playground plugin that injects twoslash (// ^?) type hints as literal comments in your code, making them easy to copy and share.

This plugin also supports twoslash arrow queries (//=>).

If placed at the end of a line, it finds the first position on that line with type information and inserts it.

let foo = 1; //=> number

If placed on its own line, it looks at the previous line, finds the first position with type information, and inserts it.

let foo = 1;
//=> number
demo.mov

Running this plugin

or

  • Open up the TypeScript Playground
  • Go the "Plugins" in the sidebar
  • Look for "Plugins from npm"
  • Add "shareable-twoslash-comments"
  • Reload the browser

Then it will show up as a tab in the sidebar.

Contributing

See CONTRIBUTING.md for the full details, however, TLDR:

git clone ...
yarn install
yarn start

Then tick the box for starting plugin development inside the TypeScript Playground.

About

Shareable Twoslash Comments is a TypeScript Playground plugin that injects twoslash (// ^?) type hints as literal comments in your code, making them easy to copy and share.

Topics

Resources

Contributing

Stars

5 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages