ts-to-jsdoc

2.1.0 • Public • Published

TypeScript to JSDoc

Transpile TypeScript code annotated with JSDoc to fully compatible JavaScript code, preserving your documentation.

Usage

Command Line

$ ts-to-jsdoc

Usage:
  ts-to-jsdoc [options] <path>...
  ts-to-jsdoc -p path/to/tsconfig.json

Options:
  -h --help          Shows this.
  -p --project       Path to tsconfig.json.
  -o --out --output  Directory to output transpiled JavaScript. [default: source path, ignored if project is set]
  -i --ignore        File or directory paths to ignore when transpiling. [ignored if project is set]
  -f --force         Overwrite existing output files. [ignored if project is set]

Node.js

const { transpileFile, transpileProject } = require("ts-to-jsdoc");
// or
import { transpileFile, transpileProject } from "ts-to-jsdoc";

const code = `
/**
 * Does stuff.
 * @param param It's a parameter.
 */
function doStuff(param: string): number { }
`;

const transpiledCode = transpileFile({ code: code });
// Output:
// /**
//  * Does stuff.
//  * @param {string} param It's a parameter.
//  * @returns {number}
//  */
// function doStuff(param) { }

/* Or you can transpile an entire project at once */
transpileProject({ project: "path/to/tsconfig.json" });

License

MIT © futurGH.

Package Sidebar

Install

npm i ts-to-jsdoc

Weekly Downloads

81

Version

2.1.0

License

MIT

Unpacked Size

31.1 kB

Total Files

6

Last publish

Collaborators

  • futuristick