-
-
Couldn't load subscription status.
- Fork 7
Closed
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
unist-util-visit-parents@6..0.0
Steps to reproduce
import { SKIP, visitParents } from 'unist-util-visit-parents'; import type { Root } from 'mdast'; export default function remarkDirectiveRehype() { return function (tree: Root) { visitParents(tree, 'containerDirective', (node) => { // now node.type infers to 'containerDirective', correct! }); }; }import { SKIP, visitParents } from 'unist-util-visit-parents'; import type { Root } from 'mdast'; export default function remarkDirectiveRehype() { return function (tree: Root) { visitParents(tree, ['containerDirective', 'leafDirective', 'textDirective'], (node) => { // now node.type infers to every possible nodes, incorrect! }); }; }Actual behavior
(property) type: "containerDirective" | "leafDirective" | "textDirective" | "root" | "blockquote" | "break" | "code" | "definition" | "delete" | "emphasis" | "footnoteDefinition" | "footnoteReference" | "heading" | "html" | "image" | "imageReference" | "inlineCode" | "link" | "linkReference" | "list" | "listItem" | "paragraph" | "strong" | "table" | "tableCell" | "tableRow" | "text" | "thematicBreak" | "yaml" | "inlineMath" | "math"
Expected behavior
(property) type: "containerDirective" | "leafDirective" | "textDirective"
Runtime
node@22.16.0
Package manager
pnpm@10.17.1
Operating system
Windows 11
Build and bundle tools
Astro
Metadata
Metadata
Assignees
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes