diff --git a/index.test-d.ts b/index.test-d.ts index 48dbd93..c831675 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -204,6 +204,20 @@ visit(sampleTree, 'definition', function (node) { }) }) +visit(sampleTree, ['definition'], function (node) { + visit(node, function (node, _, parent) { + expectNotType(node) + expectNotType(parent) + }) +}) + +visit(sampleTree, ['definition'] as const, function (node) { + visit(node, function (node, _, parent) { + expectType(node) + expectType(parent) + }) +}) + function isHeading(node: Node): node is Heading { return node ? node.type === 'heading' : false } diff --git a/lib/index.js b/lib/index.js index 0d521ed..f4e61b2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -51,8 +51,8 @@ /** * @typedef {( - * Check extends Array - * ? MatchesOne + * Check extends ReadonlyArray + * ? MatchesOne * : MatchesOne * )} Matches * Check whether a node matches a check in the type system.