Suggestion: Refactor extract to type alias/typedef · Issue #23869 · microsoft/TypeScript (original) (raw)

TypeScript Version: 2.9.0-dev.201xxxxx

Search Terms: Refactor, extract type, typedef

In a TypeScript file Extract to type alias:

var x: { a: number, b: string } = { .. };

would generate:

type newType = { a: number, b: string } var x: newType = { .. };

In a JavaScript file Extract to typedef:

/** @type {import("./c2").mytype} */ var x;

would generate:

/** @typedef {import("./c2").mytype} newType */

/**@type {myType} */ var x;

gif courtesy of @DanielRosenwasser

extracttypealias