Skip to content

test type infer is wrong when test is a const array #39

@JounQin

Description

@JounQin

Initial checklist

Affected package

unist-util-visit@5.0.0

Steps to reproduce

Like syntax-tree/unist-util-visit-parents#17

import { Root } from 'mdast' import { visit } from 'unist-util-visit' export default function plugin() { return function (tree: Root) { visit(tree, ['link', 'linkReference'] as const, node => { console.log(node) // ^? }); }; }

TypeScript Playground

Actual behavior

Image

Expected behavior

node should be Link | LinkReference

Runtime

No response

Package manager

No response

Operating system

No response

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions