How do you export parser Typescript types along with the parser?
See original GitHub issueI’m using peggy to generate a parser that I’m publishing to npm. The project the parser is in uses typescript.
I build the output file from peggy ./dist/parser.js. In my project, I also have ./parser.d.ts, where I give the parser generated by peggy its type:
export function parse(input: string): Program;
I compile typescript also the ./dist folder. My hope was that the parser.js from peggy and the parser.d.ts file from typescript would line up in the export.
However, after an npm publish of package, there is no parser.d.ts. And on import of package/dist/parser in my other project, it complains of no types for the parser.
I’m hoping this is a solved problem and I’m barking up the wrong tree.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
typescript-parser
Generates typescript code for a class property accessor. export. Parameters. accessor: AccessorDeclaration. __namedParameters: object. tabSize ...
Read more >Typescript types should parse correctly · Issue #50 - GitHub
Since eslint-plugin-jsdoc is the now-recommended way to lint jsdoc, and it relies on jsdoctypeparser, jsdoctypeparser should parse Typescript types.
Read more >Type-safely parsing JSON to a TypeScript Interface
In the box on the right, select TypeScript as the Language and make sure Verify JSON.parse results at runtime is turned-on. Quicktype will ......
Read more >@types/accept-language-parser - npm
Details. Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/accept-language-parser.
Read more >Typescript csv-parse - Stack Overflow
d.ts in @types/csv-parse from: export = parse;. to: export default ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I personally rolled back to
pegjs@0.10.0,ts-pegjs@0.3.1Output required a little tweaking (escaped JS code like imports must be moved to the appropriate place)thank you, did this as well.