Skip to content

futurGH/ts-to-jsdoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Transpile TypeScript code to fully compatible JavaScript + JSDoc comments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published