Skip to content

Support TS instantiation expression #14322

@sosukesuzuki

Description

@sosukesuzuki

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

Babel does not support new TS instantiation expression microsoft/TypeScript#47607

function makeBox<T>(value: T) {
    return { value };
};

const makeStringBox = makeBox<string>;  // (value: string) => { value: string }
const stringBox = makeStringBox('abc');  // { value: string }

const ErrorMap = Map<string, Error>;  // new () => Map<string, Error>
const errorMap = new ErrorMap();  // Map<string, Error>

Describe the solution you'd like

Implement it.

Adds new AST node TSInstantiationExpression.

interface TSInstantiationExpression {
  type: "TSInstantiationExpression";
  expression: Expression;
  typeParameters: TSTypeParameterInstantiation;
}

Describe alternatives you've considered

Nothing.

Documentation, Adoption, Migration Strategy

microsoft/TypeScript#47607

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions