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 method not present in type declarations #10075

Closed
jhpratt opened this issue Jun 9, 2019 · 6 comments · Fixed by #10098
Closed

super method not present in type declarations #10075

jhpratt opened this issue Jun 9, 2019 · 6 comments · Fixed by #10098
Labels
area: typescript Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types

Comments

@jhpratt
Copy link

jhpratt commented Jun 9, 2019

Bug Report

Current Behavior
Calling t.super() results in a compile-time type error, as super isn't present in type definitions. It does exist in the documentation and works as expected after compilation.

Expected behavior
The super method should be present in the type definitions.

Babel Configuration (.babelrc, package.json, cli command)
Not applicable.

Environment

  • Babel version(s): v7.4.0
  • Node/npm version: Node 12.0.0, npm 6.9.0
  • OS: Ubuntu 19.04
  • Monorepo: no
  • How you are using Babel: CLI

As someone using TypeScript to minimize errors, the amount of casting is extremely verbose. By itself, that's not an issue, but coupled with errors in type definitions (this along with #10065) are forcing the use of unsafe casts and // @ts-ignore.

@jhpratt jhpratt added the i: bug label Jun 9, 2019
@babel-bot
Copy link
Collaborator

Hey @jhpratt! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

I'm not a TS expert, but how could we write this type definition so that it is valid code?

export function super() {}

@jhpratt
Copy link
Author

jhpratt commented Jun 12, 2019

@nicolo-ribaudo It's my understanding type definitions are auto-generated, so I'm not sure where the error is truly at.

A simple definition like declare function super(): Super; should suffice.

@nicolo-ribaudo
Copy link
Member

No, super is a keyword.

@tanhauhau
Copy link
Member

tanhauhau commented Jun 14, 2019

I figured we can do

declare function _super(): Super;
export { _super as super }

@JLHwung
Copy link
Contributor

JLHwung commented Sep 5, 2019

Fixed by #10098

@JLHwung JLHwung closed this as completed Sep 5, 2019
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants