Initial checklist
Affected package
unist-util-visit
Steps to reproduce
use typescript, have a simple plugin:
import type { Pluggable } from 'unified'
import { visit } from 'unist-util-visit';
const removePre: Pluggable = (/* options */) => {
return function transformer(tree) {
visit(tree, ['code'], function (node, index, parent) {
// ^ type: any
if (!parent) return;
if (undefined === index) return;
parent.children[index] = {
// ^ type: never
parent should be Parent | undefined as reported by:
but somewhere alone the line the fix was lost.
Actual behavior
type is incorrect
Expected behavior
type is correct
Runtime
No response
Package manager
No response
Operating system
No response
Build and bundle tools
No response
Initial checklist
Affected package
unist-util-visit
Steps to reproduce
use typescript, have a simple plugin:
parentshould beParent | undefinedas reported by:but somewhere alone the line the fix was lost.
Actual behavior
type is incorrect
Expected behavior
type is correct
Runtime
No response
Package manager
No response
Operating system
No response
Build and bundle tools
No response