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

any in ClassDeclaration fields in TypeScript type in @babel/types since 7.8.0 #11474

Closed
1 task
grubersjoe opened this issue Apr 24, 2020 · 2 comments
Closed
1 task
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@grubersjoe
Copy link

grubersjoe commented Apr 24, 2020

Bug Report

  • I would like to work on a fix!

Current Behavior

I updated @babel/types from ~7.7.0 to the latest version 7.9.5 and noticed that all of a sudden I get new TypeScript errors. The Problem is that beginning with @babel/types@7.8.0 a lot of fields of the ClassDeclaration type use any instead of more specific types used before (compare below). Because I use the noImplicitAny option of the TypeScript compiler new errors occur.

// Current type declaration (^7.8.0)
export interface ClassDeclaration extends BaseNode {
  type: "ClassDeclaration";
  id: any;
  superClass: any;
  body: any;
  decorators: any;
  abstract: boolean | null;
  declare: boolean | null;
  implements: any;
  mixins: any;
  superTypeParameters: any;
  typeParameters: any;
}

Expected behavior/code

I would expect that an minor upgrade does not break types. I'm not sure if there was a specific reason to set this to any or if it is simply a bug in type generation or somewhere else.

// Old type declaration (~7.7.0)
export interface ClassDeclaration extends BaseNode {
  type: "ClassDeclaration";
  id: Identifier | null;
  superClass: Expression | null;
  body: ClassBody;
  decorators: Array<Decorator> | null;
  abstract: boolean | null;
  declare: boolean | null;
  implements: Array<TSExpressionWithTypeArguments | ClassImplements> | null;
  mixins: any | null;
  superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation | null;
  typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null;
}

Environment

System:
    OS: Linux 5.6 Arch Linux
Binaries:
    Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
 npmPackages:
    @babel/types: ~7.8.0 => 7.8.7 
Monorepo: no
How you are using Babel: babel-loader

Possible Solution

Use the more specific types as before.

Should I provide more information/context?

@babel-bot
Copy link
Collaborator

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

@grubersjoe grubersjoe changed the title any in ClassDeclaration fields in TypeScript type in @babel/types any in ClassDeclaration fields in TypeScript type in @babel/types as of 7.8.0 Apr 24, 2020
@grubersjoe grubersjoe changed the title any in ClassDeclaration fields in TypeScript type in @babel/types as of 7.8.0 any in ClassDeclaration fields in TypeScript type in @babel/types since 7.8.0 Apr 24, 2020
@grubersjoe
Copy link
Author

grubersjoe commented Jul 12, 2020

Closing this, since it was fixed in #11687 .

@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 Oct 12, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

2 participants