Skip to content

Compiler does not allow abstract generators #25710

@aleph-naught2tog

Description

@aleph-naught2tog

TypeScript Version: First noticed on 2.9.1, confirmed in 3.0.0-dev.20180712

Search Terms:
generator abstract, "An overload signature cannot be declared as a generator.", generator overload, overload generator abstract, TS1222

Code

abstract class SomethingAbstract {
    // TS1222: An overload signature cannot be declared as a generator.
    abstract *sadGenerator(): any; // specifying a return type doesn't help
    *fineGenerator(): any {}
}

Expected behavior:
The compiler should allow abstract generator methods.

Actual behavior:
The compiler does not allow abstract generator methods: instead, it errors with: [ts] An overload signature cannot be declared as a generator.

I believe I know where and why this is and I'll open up a PR once I fix it.

Playground Link: Small sample

Related Issues:
Couldn't find any related ones

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions