hegemonic / catharsis

A JavaScript parser for Google Closure Compiler and JSDoc type expressions.
MIT License
54 stars 14 forks source link

implementation question #50

Closed jonschlinkert closed 7 years ago

jonschlinkert commented 7 years ago

I'm working on a tool that might use jsdoctypeparser but I just noticed this library and saw that it's similar but seems to lean towards closure compiler (is that correct? I'm still getting familiarized with the different specs).

Do you have a recommendation between this and jsdoctypeparser. Will catharsis be used in jsdoc? (just trying to decide which one I should focus on implementing). Thanks!

edit: also, in the returned object, does variable mean "variadic" (e.g. variable number of arguments)? I reviewed the docs and didn't see it (sorry if I missed it).

hegemonic commented 7 years ago

JSDoc uses Catharsis to parse type expressions, so if you want to match JSDoc's behavior, using this library is your best bet. Both JSDoc and Catharsis should support all valid Closure Compiler type expressions, plus a few old-school-JSDoc-style type expressions (for example, string[] instead of Array<string>).

I'm not familiar with jsdoctypeparser, so I can't comment on its merits.

In the returned object, I think Catharsis uses the property repeatable, not variable, to indicate a variadic argument. (JSDoc does use variable, though, if I recall correctly.) If you're seeing variable in a Catharsis parse result, please file a new issue with the type expression you're parsing and the JSON-stringified version of the parsed type, and I'll investigate.

Hope that helps!

jonschlinkert commented 7 years ago

JSDoc uses Catharsis to parse type expressions, so if you want to match JSDoc's behavior, using this library is your best bet

oh, sorry I don't know how I missed that! I looked but must have missed it.

I think Catharsis uses the property repeatable

Got it, and I'm guessing that also means variadic. thanks

sorry again, for some reason I thought you authored both libs and had those confused. I'm trying to wrap my brain around all of the different code-comment documentation conventions. Apologies for wasting your time with that.