ohm icon indicating copy to clipboard operation
ohm copied to clipboard

Typescript example causes error

Open toddobryan opened this issue 2 years ago • 1 comments

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.)

toddobryan avatar Sep 18 '23 04:09 toddobryan

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

mattbruv avatar Feb 09 '24 20:02 mattbruv