peggyjs / peggy

Peggy: Parser generator for JavaScript
https://peggyjs.org/
MIT License
906 stars 64 forks source link

Typescript .d.ts for generated grammars #477

Closed hildjj closed 1 week ago

hildjj commented 6 months ago

If desired, output a generic .d.ts file for the generated grammar. The caller will need to provide the expected return type. This is NOT a replacement for ts-pegjs, it is just the bare minimum needed. No actual type checking will be performed. Start by cutting down the hand-maintained peg.d.ts into just the things needed for generated parsers (including SyntaxError and dependencies), then add a small number of generics.