facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.22k stars 477 forks source link

tsx cannot find property #510

Open linddxxx opened 2 years ago

linddxxx commented 2 years ago
import jscodeshift from "jscodeshift";

const jsc= jscodeshift.withParser("tsx")
const properties = jsc("const a={b:1};").find(jsc.Property);

properties cannot find property b

ElonVolo commented 2 years ago

Away from computer so I haven't yet validated that this works, but try changing Property to ObjectProperty

I believe the node type got changed on babel 6.

https://github.com/babel/babel/blob/main/.github/CHANGELOG-v6.md

Haroenv commented 1 year ago

I'm getting weird behaviour that in the jscodeshift test utils the type is called a Property, but when running the code for real it's ObjectProperty, I wonder why