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

[TS] "Abstract methods can only appear within an abstract class" on "export default abstract class" #12745

Closed
1 task
gentoid opened this issue Feb 3, 2021 · 7 comments · Fixed by #12748
Closed
1 task
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@gentoid
Copy link

gentoid commented Feb 3, 2021

Bug Report

  • I would like to work on a fix!

Current behavior

I'm getting the Abstract methods can only appear within an abstract class. error on export default abstract class AbstractClass after bumping "@babel/core" from "7.12.10" to "7.12.13"

Input Code

Copied from the repro repo

abstract class WorkingAbstractClass {
    abstract test(): void;
}

class SomeClass extends WorkingAbstractClass {
    test(): void {
        console.log('ok!');
    }
}

export abstract class AbstractClassIsWorkingToo {
    abstract test(): void;
}

// this is the case where Babel raises the error
export default abstract class NotWorkingAbstractClass {
    abstract test(): void;
}

Expected behavior

I guess it should be according to the TS behaviour, i.e., this case should be allowable.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: .babelrc

Copied from the repro repo

{
    "presets": [
        "@babel/typescript"
    ]
}

Environment

  System:
    OS: Windows 10 10.0.18363
  Binaries:
    Node: 12.16.0 - ~\scoop\apps\nvm\current\nodejs\nodejs\node.EXE
    Yarn: 1.22.5 - ~\scoop\apps\yarn\current\Yarn\bin\yarn.CMD
    npm: 6.14.11 - ~\scoop\apps\yarn\current\global\node_modules\.bin\npm.CMD
  npmPackages:
    @babel/cli: ^7.12.13 => 7.12.13
    @babel/core: ^7.12.13 => 7.12.13
    @babel/preset-typescript: ^7.12.13 => 7.12.13

Possible Solution

Do not treat such cases as a syntax error

Additional context

@babel-bot
Copy link
Collaborator

Hey @gentoid! 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."

@Mrjeff578575
Copy link

the same issue

@nicolo-ribaudo
Copy link
Member

Fixed in v7.12.14.

@forivall
Copy link
Contributor

forivall commented Feb 3, 2021

Was caused by #12686

@gentoid
Copy link
Author

gentoid commented Feb 3, 2021

seems it wasn't published to the NPM registry

@nicolo-ribaudo
Copy link
Member

@gentoid
Copy link
Author

gentoid commented Feb 3, 2021

Ah, thanks. I wrongly checked @babel/core

na9da added a commit to TerriaJS/terriajs that referenced this issue Feb 3, 2021
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants