jscodeshift icon indicating copy to clipboard operation
jscodeshift copied to clipboard

tsx cannot find property

Open linddxxx opened this issue 1 year ago • 2 comments

import jscodeshift from "jscodeshift";

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

properties cannot find property b

linddxxx avatar Jul 14 '22 10:07 linddxxx

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

ElonVolo avatar Jul 15 '22 05:07 ElonVolo

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

Haroenv avatar Aug 10 '23 09:08 Haroenv