Skip to content

Commit

Permalink
Merge pull request #103 from metadevpro/fix/i-102-export-PeggySyntaxE…
Browse files Browse the repository at this point in the history
…rror

fix #102
  • Loading branch information
pjmolina authored Apr 14, 2023
2 parents 53e09b6 + 944b081 commit 67d424b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/passes/generate-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ export interface ParseOptions {
${parseFunctionType}
export const parse: ParseFunction = peggyParser.parse;
`);
rootNode.add(
`\nexport const ${errorName} = peggyParser.SyntaxError as typeof _PeggySyntaxError;\n`
);
rootNode.add([
`\nexport const ${errorName} = peggyParser.SyntaxError as typeof _PeggySyntaxError;\n`,
`\nexport type ${errorName} = _PeggySyntaxError;\n`
]);
if (options.trace) {
rootNode.add(
`\nexport const DefaultTracer = peggyParser.DefaultTracer as typeof _DefaultTracer;\n`
);
rootNode.add([
`\nexport const DefaultTracer = peggyParser.DefaultTracer as typeof _DefaultTracer;\n`,
`\nexport type DefaultTracer = _DefaultTracer;\n`
]);
}

if (computedTypes) {
Expand Down

0 comments on commit 67d424b

Please sign in to comment.