Declaration has "null" loc field when inside export
slonoed opened this issue · 1 comments
slonoed commented
Happens with jscodeshift@0.14
Simplest demonstration
This returns null
require('jscodeshift')('export const a = 1').nodes()[0].program.body[0].declaration.loc
While this returns proper location
require('jscodeshift')('const a = 1').nodes()[0].program.body[0].loc
Same happens when exporting class
ElonVolo commented
This seems like old recast bug from five years ago that has yet to be fixed.https://github.com/benjamn/recast/issues/557Sent from my iPhoneOn May 12, 2023, at 18:57, Dmitry Manannikov ***@***.***> wrote:
Happens with ***@***.***
Simplest demonstration
This returns null
require('jscodeshift')('export const a = 1').nodes()[0].program.body[0].declaration.loc
While this returns proper location
require('jscodeshift')('const a = 1').nodes()[0].program.body[0].loc
Same happens when exporting class
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>