-
-
Notifications
You must be signed in to change notification settings - Fork 4
Improve generic types #4
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
Conversation
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.
Nice, thanks Juan! Just a Q / style nit
complex-types.d.ts
Outdated
@@ -0,0 +1,19 @@ | |||
import type {Node, Parent} from 'unist' | |||
|
|||
export type NodeOfTree< |
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.
export type NodeOfTree< | |
/** | |
* Internal utility to collect all descendants of in `Tree`. | |
* @see https://github.com/syntax-tree/unist-util-visit-parents/blob/18d36ad/complex-types.d.ts#L43 | |
*/ | |
export type InclusiveDescendant< |
Perhaps good to reference where it comes from?
And, what do you think of that original name, InclusiveDescendant
?
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.
I though NodeOfTree
was more explicit, but I can change 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.
I understand.
Several terms in unist and friends are also used in other places that deal with trees, including the DOM for example. Descendant and inclusive descendant stem from that.
Some more common terms: https://github.com/syntax-tree/unist#glossary
Co-authored-by: Titus <[email protected]>
This comment has been minimized.
This comment has been minimized.
Released in 3.1.0! |
Related-to: GH-4. Closes Gh-5. Reviewed-by: Titus Wormer <[email protected]>
Initial checklist
Description of changes
Continuation of #3. This PR adds better types for
map()
inspired by the types ofunist-util-visit-parents
.