esquery v1.4.0
const literal = espree.parse("1").body[0].expression;
const selector = esquery.parse(":has(Literal)");
esquery.matches(literal, selector); // true
Or. in the esquery demo, enter 1 as code, :has(Literal) as selector. It finds "Program", "ExpressionStatement", and "Literal".
I was expecting that selectors in :has() can match only descendants of the node, but in the above examples :has(Literal) matches a Literal node. Is this the intended behavior?