Skip to content

Suggestion: Refactor extract to type alias/typedef #23869

@mhegazy

Description

@mhegazy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CommittedThe team has roadmapped this issueDomain: JSDocRelates to JSDoc parsing and type generationDomain: LS: Refactoringse.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions