Skip to content

GeneratorFunction should not be newable #56645

@LongTengDao

Description

@LongTengDao

⚙ Compilation target

ES2015 ES2018

⚙ Library

generator asyncgenerator

Missing / Incorrect Definition

GeneratorFunction and AsyncGeneratorFunction (async function * () {}) should not be newable.

GeneratorFunction means function * () {} which is only callable, while GeneratorFunctionConstructor means function * () {}.constructor which is both callable and newable.

Sample Code

declare const gen: GeneratorFunction;
new gen;// there should cause a type error, but not

Documentation Link

No response

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions