2

I've generated a parser using PEG.js and I'm trying to use the parser in a service class. I just have no idea how to import it into my typescript class.

Do I just need to create a typescript definition file? I'm new to typescript and I'm not great at javascript to begin with, so I'm sure this is a stupid question.

Let me know if you need any additional information.

Jimeh
  • 367
  • 1
  • 6
  • 16
  • Did you end up finding a solution? – NJ. Nov 01 '17 at 03:10
  • I did not. It wasn't an overly complicated problem so I did it manually with javascript instead of using the generated parser. It would have been nice to do it using PEG.js though... oh well. – Jimeh Nov 01 '17 at 17:41

1 Answers1

3

There are already types for pegjs

https://www.npmjs.com/package/@types/pegjs

Just install and save that package and pegjs

Rafa de Castro
  • 2,474
  • 1
  • 24
  • 44