tsquery icon indicating copy to clipboard operation
tsquery copied to clipboard

maybe attribute eq/neq could be more type infered?

Open ssddi456 opened this issue 3 years ago • 1 comments
trafficstars

https://github.com/phenomnomnominal/tsquery/blob/a81e09346c1227a756ddd279e54728753614c2c9/src/matchers/attribute.ts#L39-L53

unlike esquery they dont have any type info, tsquery could be more type infered, for example, with code

const routeMap = [{}]

we could do somethings like:

VariableDeclaration[name.name="routeMap"][initializer=type(ArrayLiteralExpression)]

which is more accurate than some thing

VariableDeclaration[name.name="routeMap"]):has(ArrayLiteralExpression)

ssddi456 avatar Oct 25 '22 12:10 ssddi456

I don't really know how something like this would work, since the type information isn't necessarily available to you at the point when a query is running. Can you add some more details, give some use-cases, suggest how to integrate the type checker into TSQuery?

phenomnomnominal avatar Jul 10 '23 12:07 phenomnomnominal