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
convert @babel/helper-function-name to TypeScript #12486
convert @babel/helper-function-name to TypeScript #12486
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/35399/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1e1868f:
|
7607e40
to
a64e701
Compare
@@ -2,7 +2,7 @@ import getFunctionArity from "@babel/helper-get-function-arity"; | |||
import template from "@babel/template"; | |||
import * as t from "@babel/types"; | |||
|
|||
const buildPropertyMethodAssignmentWrapper = template(` | |||
const buildPropertyMethodAssignmentWrapper = template.statement(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Why do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this way it was more granular type (just t.Statement
instead of union of all possible options - I remember in some place ts was complaining about possible array instead of ast node), however - later I anyway added more typecasts… so this is no longer needed - reverting it
@@ -150,7 +153,10 @@ function visit(node, name, scope) { | |||
* @param {NodePath} param0 | |||
* @param {Boolean} localBinding whether a name could shadow a self-reference (e.g. converting arrow function) | |||
*/ | |||
export default function ({ node, parent, scope, id }, localBinding = false) { | |||
export default function ( | |||
{ node, parent, scope, id }: any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ node, parent, scope, id }: any, | |
{ node, parent, scope, id }: { node: any, parent: any, scope: any, id: any }, |
It's still full of any
s, but at least it gives basic safety against typos and autocompletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,
Ideally it should use NodePath
, but there is an issue about circular dependency to use it
a64e701
to
1e1868f
Compare
@babel/helper-function-name part of #11578