Content-Length: 347152 | pFad | https://github.com/microsoft/TypeScript/issues/23869

4C Suggestion: Refactor extract to type alias/typedef · Issue #23869 · microsoft/TypeScript · GitHub
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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/microsoft/TypeScript/issues/23869

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy