Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing only a Setter is enough to implement an Interface #33621

Closed
willemneal opened this issue Sep 26, 2019 · 3 comments
Closed

Implementing only a Setter is enough to implement an Interface #33621

willemneal opened this issue Sep 26, 2019 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@willemneal
Copy link

TypeScript Version: 3.6.3

Search Terms: only setter in class implements interfaces. Interface property bugs.

Code

interface Properties {
  val: number;
}

class BadProps implements Properties {
  private _val: number = 42;
  set val(newVal: number) {
    this._val = newVal;
  }
}

Expected behavior:
A type error that the implementing class is missing the getter.

Actual behavior:
Just runtime error of undefined.

Playground Link:
Above example

Related Issues:

@j-oliveras
Copy link
Contributor

Probably related to PR #33509 by @sandersn

@RyanCavanaugh
Copy link
Member

Duplicate #30852; others

@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants