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
Add all missing babel-core
option properties and alphabetize for better maintainability.
#19428
Conversation
types/babel-core/index.d.ts to authors (@yortus @marvinhagemeister). Could you review this PR? Checklist
|
@amiller-gh Please fix the failures indicated in the Travis CI log. |
Using types |
Will update – saw it used elsewhere in the file for Babylon config passthroughs, thought it may be okay. |
You must have seen Why not import |
…properties alphabetically for maintainability.
PR updated with a much less lazy change – Now all missing Babel Core options have been added, and all the options have been alphabetized like in the Babel documentation. |
@@ -10,10 +10,12 @@ export { t as types }; | |||
export type Node = t.Node; | |||
export import template = require('babel-template'); | |||
export const version: string; | |||
import traverse, { Visitor } from "babel-traverse"; | |||
import traverse, { Visitor, NodePath } from "babel-traverse"; |
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 NodePath
isn't used. Did you want to use it for wrapPluginVisitorMethod
?
The rest looks great.
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.
Left over from my trying to get wrapPluginVisitorMethod
to have better specified types – was going to ask about that actually. The callback function it takes and the function it returns can take any NodePath
variant. I couldn't come up with a way to add concrete typing to those functions without enumerating every templated type, like is done in babel-traverse
. Do you have a better way to do this?
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.
Simple NodePath
(AKA NodePath<Node>
) is okay in this case.
parserOpts
to TransformOptions
interface for @types/babel-corebabel-core
option properties and alphabetize for better maintainability.
@thorn0 - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
@@ -10,10 +10,12 @@ export { t as types }; | |||
export type Node = t.Node; | |||
export import template = require('babel-template'); | |||
export const version: string; | |||
import traverse, { Visitor } from "babel-traverse"; | |||
import traverse, { Visitor, NodePath } from "babel-traverse"; |
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.
Simple NodePath
(AKA NodePath<Node>
) is okay in this case.
types/babel-core/index.d.ts
Outdated
|
||
/** Specify a custom name for module ids. */ | ||
moduleId?: string; | ||
wrapPluginVisitorMethod?(pluginAlias: string, visitorType: string, callback: (path: any, state: any) => void): (path: any, state: any) => void ; |
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.
trying to get wrapPluginVisitorMethod to have better specified types – was going to ask about that actually. The callback function it takes and the function it returns can take any NodePath variant.
That's why the parent type should be used - NodePath
(same as NodePath<Node>
). All the variants are assignable to it, and there is no possibility to infer the specific subtype from anywhere, so the user has to use type guards or assertions anyway to work with specific subtypes. Which is unlikely however because the wrapPluginVisitorMethod
option is intended for simpler use cases, see the original PR babel/babel#3659.
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.
Since we're on it, visitorType
can be typed as 'enter' | 'exit'
, can't it?
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.
Updated 👍
Looks good. 👍 Formally, I'm not a reviewer of this package, so now I think you need an approve from one of them. |
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.
LGTM 👍
Approved by a listed owner. PR ready to merge pending express review by a maintainer. |
* Enable new State / Substate method syntax - Bump css-blocks so correlations aren't enumerated. Update tests accordingly. - Remove explicit state import from blocks - States are now methods on Blocks and Classes - Static and dynamic substates may be passed to State methods - Add error checking for mis-use of boolean states - States with sub-states must be passed a value - Initial infrastructure added to construct boolean expressions - Use new css-block analysis introspection methods in tests - Move BlockObject lookup logic to ExpressionReader - Remove detailed ast and source data from Template when no longer needed. - Add new babel-core types file locally until DefinitelyTyped/DefinitelyTyped#19428 lands
Please fill in this template.
npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
.