Skip to content

super call in an subclass arrow function property needs type error (prevents a runtime error) #49317

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

Closed
trusktr opened this issue May 31, 2022 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@trusktr
Copy link
Contributor

trusktr commented May 31, 2022

Bug Report

🔎 Search Terms

super call subclass arrow function

🕗 Version & Regression Information

  • This is a crash (runtime, with no type error)
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _________

⏯ Playground Link

Playground link with relevant code

💻 Code

class Foo {
  method = () => {
    console.log('Foo.method')
  }
}

class Bar extends Foo {
  method = () => {
    super.method() // Should be a type error, because this fails at runtime.
    console.log('Foo.method')
  }
}

new Bar().method()

🙁 Actual behavior

No type error, but there is a runtime error. Here's the error in Chrome:

TypeError: (intermediate value).method is not a function

🙂 Expected behavior

TypeScript can show a type error for this case.

@trusktr trusktr changed the title super call in an subclass arrow function property should have a type error (it has a runtime error) super call in an subclass arrow function property needs type error (prevents a runtime error) May 31, 2022
@MartinJohns
Copy link
Contributor

Duplicate of #24678. Used search terms: super property in:title

@RyanCavanaugh
Copy link
Member

Same as #42214

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jun 2, 2022
@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