Skip to content

Abstract accessor with implementation #12560

Closed
@aozgaa

Description

@aozgaa

TypeScript Version: master, commit 1418fd1

Are abstract getters/setters allowed to have an implementation?

Related: #7184

Code

abstract class A {
    private _a: string;

    abstract get a(): string {
        return this._a;
    }

    abstract set a(newName: string) {
            this._a = newName;
    }
}

Expected behavior:

Error on get and set that abstract getters/setters shouldn't have an implementation.

Actual behavior:

No error.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions