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

super() typed as returning void #59959

Open
rahbari opened this issue Sep 13, 2024 · 2 comments
Open

super() typed as returning void #59959

rahbari opened this issue Sep 13, 2024 · 2 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@rahbari
Copy link

rahbari commented Sep 13, 2024

💻 Code

class Parent {}

class Child extends Parent {
	constructor() {
		super().func();
	}

	func() {

	}
}

🙁 Actual behavior

super() in constructor return the object but TS assumes it returns void:

image

🙂 Expected behavior

super() should return the object.

@RyanCavanaugh RyanCavanaugh changed the title super() in constructor falsely returns void super() typed as returning void Sep 13, 2024
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Sep 13, 2024
@RyanCavanaugh
Copy link
Member

I'm curious why this is clearer than

super();
this.func();

@MartinJohns
Copy link
Contributor

Sounds like a duplicate of #37847 / #42298 to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants