waxeye-org / waxeye

Waxeye is a parser generator based on parsing expression grammars (PEGs). It supports C, Java, JavaScript, Python, Racket, and Ruby.
https://waxeye-org.github.io/waxeye/index.html
Other
235 stars 38 forks source link

waxeye does not compile with TS2.9 #88

Closed mprobst closed 6 years ago

mprobst commented 6 years ago

I'm getting something like this (with a slightly outdated version of waxeye):

waxeye/src/javascript/waxeye.ts:11:31 - error TS2322: Type 'string | number' is not assignable to type 'string'.
  Type 'number' is not assignable to type 'string'.

11   public parse(input: string, start: string = this.start): AST|ParseError {
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
waxeye/src/javascript/waxeye.ts:384:55 - error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'.
  Type 'string | number' is not assignable to type 'string'.
    Type 'number' is not assignable to type 'string'.

384       evalNext(env[start].exp, 0, [], new RawError(0, [start], [], start), []));
                                                          ~~~~~~~
waxeye/src/javascript/waxeye.ts:655:28 - error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.

655             return new AST(start, asts.reverse());
                               ~~~~~
waxeye/src/javascript/waxeye.ts:668:32 - error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.

668                 return new AST(start, asts.reverse());
                                   ~~~~~
glebm commented 6 years ago

Looks like keyof RuntimeParserConfig should now be changed to Extract<keyof RuntimeParserConfig, string>

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html

glebm commented 6 years ago

@mprobst Fixed in #89

mprobst commented 6 years ago

Thanks!

Gleb Mazovetskiy notifications@github.com schrieb am So., 24. Juni 2018 um 19:29 Uhr:

@mprobst https://github.com/mprobst Fixed in #89 https://github.com/orlandohill/waxeye/pull/89

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/orlandohill/waxeye/issues/88#issuecomment-399772983, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcKKy-3t4_N21HP_c_0gLjcSVsxQGzks5t_8xogaJpZM4U1MbV .