benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
MIT License
4.95k stars 346 forks source link

Getting error when trying to use b.exportSpecifier #1324

Open lockenj opened 1 year ago

lockenj commented 1 year ago

I am trying to create an Export List using: b.exportNamedDeclaration( null, [b.exportSpecifier( null, b.identifier(this.className) )] ),

I keep getting this error: Error: no value or default function given for field "exported" of ExportSpecifier("id": Identifier | null, "name": Identifier | null)

Any guidance would be appreciated

croenid commented 6 months ago

I ran into the same error. There is a workaround to use the .from method shown here: https://github.com/benjamn/ast-types/issues/425#issuecomment-1007846129