microsoft / microsoft/TypeScript
GeneratorFunction should not be newable
Open
@rbuckton is already working on this.
Since Dec 4, 2023.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
⚙ 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.