Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dprint/typescript

dprint103.5kMIT0.94.0TypeScript support: included

Wasm module for dprint-plugin-typescript.

typescript, javascript, code, formatter, dprint

readme

@dprint/typescript

npm distribution of dprint-plugin-typescript.

Use this with @dprint/formatter or just use @dprint/formatter and download the dprint-plugin-typescript Wasm file.

Example

import { createFromBuffer } from "@dprint/formatter";
import { getPath } from "@dprint/typescript";
import * as fs from "fs";

const buffer = fs.readFileSync(getPath());
const formatter = createFromBuffer(buffer);

console.log(formatter.formatText("test.ts", "const   t    =    5;"));