close
Skip to main content

JSDoc to TypeScript Converter

Convert JSDoc comments into real TypeScript type annotations. JavaScriptConverter reads @param, @returns, @type, and @typedef tags and rewrites them as inline TypeScript types — no more duplicated information between comments and signatures.

Why promote JSDoc types to TypeScript?

JSDoc is a strong convention, but it has real limitations: types live in comments, tooling support varies between editors, and nothing guarantees comments stay in sync with code. TypeScript gives you the same type expressiveness with compiler-enforced correctness, first-class refactoring, and better IDE intelligence.

If you've already done the work to document functions with JSDoc, JavaScriptConverter extracts that information and turns it into real TypeScript annotations automatically. Nothing is lost, and the compiler starts checking your types immediately.

JSDoc patterns this tool understands

@param and @returns

/**
 * @param {string} name
 * @param {number} [age]
 * @returns {string}
 */
function greet(name, age) {
  return 'Hello ' + name;
}
function greet(
  name: string,
  age?: number
): string {
  return 'Hello ' + name;
}

@type variable annotations

/** @type {Array<string>} */
const names = [];
const names: Array<string> = [];

Union and optional types

/**
 * @param {string|number} id
 */
function find(id) { /* ... */ }
function find(id: string | number) {
  /* ... */
}

What happens to parameters without JSDoc?

Parameters without JSDoc are left with TypeScript's implicit any (or explicit unknown if you enable strict mode). The converter never invents types it can't justify — unlike LLM-based tools, you get exactly what was documented and nothing more. This gives you a reliable starting point to tighten types incrementally.

Promote your JSDoc to TypeScript types

Paste a well-commented JavaScript file, press Convert, and receive real TypeScript types inline in seconds.