lezer-parser/lezer

Generated `specialized` field is not compatible with typescript strict mode

berekuk opened this issue · 4 comments

From #11 (comment):

I believe there is currently nothing in the generated output that would require a type declaration, so you should be able to just treat it as typescript.

This seems to have changed at some point.

My generated parser includes this code:

  specialized: [{term: 102, get: value => spec_identifier[value] || -1}],

Which is not compatible with Typescript strict mode or "noImplicitAny": true:
Captura de pantalla 2023-08-17 a la(s) 12 43 12

Does attached patch look like it would work for you?

I think in my case the code was generated by a different branch that you need to update too, line 493 after your patch. (I see || -1 on the screenshot, not << 1).

Oh, good point. Added another patch that makes the change there as well.

Looks good now!