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

Open
jhpratt opened this issue Jun 9, 2019 · 5 comments

Comments

Projects
None yet
4 participants
@jhpratt
Copy link

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

This comment has been minimized.

Copy link
Collaborator

commented Jun 9, 2019

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

This comment has been minimized.

Copy link
Member

commented Jun 9, 2019

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

export function super() {}
@jhpratt

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

No, super is a keyword.

@tanhauhau

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2019

I figured we can do

declare function _super(): Super;
export { _super as super }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.