ohmjs / ohm

A library and language for building parsers, interpreters, compilers, etc.
MIT License
5.01k stars 217 forks source link

Typescript example causes error #460

Open toddobryan opened 1 year ago

toddobryan commented 1 year ago

I'm trying to use Ohm with Typescript, following the example, but I keep getting an error:

 TypeError: Cannot read properties of undefined (reading 'createSemantics')

      3 | import grammar, {LangSemantics} from './lang.ohm-bundle'
      4 |
    > 5 | const semantics = grammar.createSemantics()

Using the generate command created the lang.ohm-bundle.js and lang.ohm-bundle.d.ts files correctly, as far as I can tell, but it's just not working.

I'm trying to add this to a fairly large project, and I'll admit that I'm not the most JS/TS proficient person, so I'm just wondering if there are settings in various config files that need to be set a certain way for this to all work. (And if that info could be added to the documentation.)

mattbruv commented 9 months ago

See if this helps you: https://github.com/ohmjs/ohm/pull/462

My PR has been open forever so I don't think they particularly care about this project or the fact that users are experiencing frustration