# tsheredoc

> Javascript heredoc with typescript support.

Latest version **2.0.0** (published 2026-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install tsheredoc
pnpm add tsheredoc
yarn add tsheredoc
bun add tsheredoc
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-05-29 |
| First published | 2021-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jason Walton |
| Maintainers | jwalton |
| Keywords | heredoc |

## Links

- npm: https://www.npmjs.com/package/tsheredoc
- Repository: https://github.com/jwalton/tsheredoc
- Homepage: https://github.com/jwalton/tsheredoc#readme
- Issues: https://github.com/jwalton/tsheredoc/issues
- npm.io page: https://npm.io/package/tsheredoc

## Recent versions

- 2.0.0 (latest) — 2026-05-29
- 1.0.1 — 2022-01-08
- 1.0.0 — 2021-02-04

## README

# tsheredoc

[![NPM version](https://badge.fury.io/js/tsheredoc.svg)](https://npmjs.org/package/tsheredoc)
![Build Status](https://github.com/jwalton/tsheredoc/workflows/GitHub%20CI/badge.svg)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

## What is it?

This makes is so you can generate multi-line strings without messing up your indents in Javascript/Typescript:

```ts
import heredoc from 'tsheredoc';

const usage = heredoc`
   Usage: mycommand [arguments]
   Does cool stuff.
`;
// Usage will be "Usage: mycommand [arguments]\nDoes cool stuff.\n"
```

This can be used either as a template string (as above) or as a function:

```ts
import heredoc from 'tsheredoc';

const usage = heredoc(`
   Usage: mycommand [arguments]
   Does cool stuff.
`);
// Same as above
```

---
_Source: https://npm.io/package/tsheredoc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
