-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Class constructor Lexer cannot be invoked without 'new' #283
Comments
💭 We're using target |
Yup. es2015 is ES6 (ES6 is the old name for it, I just haven't broken my habit yet :). It's still not supported by several browsers, which forces us to use ES5, even though many browsers do support it. Here's a cool graph: Are you guys using language features that require using ES 6 as a target? If not, you can probably simply change the typescript target, and a lot more projects would be able to easily use it. For our project, we actually need to generate ES 6 from typescript (because we use generator functions), but we then run it through Babel to get to ES5. Not sure if that would be an option. Thanks! |
I have no idea. There's a fairly comprehensive test suite, so if you send a pull request that changes the target it will probably fail the automated build and tell you if something broke. :) |
Hmm. I tried doing a build before trying any changes and am getting a problem. The build seems to be running fine, and then I get the following errors. Is there something I'm doing wrong? I'm trying to build using 'npm install'
benchmark/TestPerformance.ts(61,40): error TS2307: Cannot find module './gen/std/JavaLexer'. |
So far, we've only been testing on Node.js. Browser support should probably be added to our roadmap. We are using ES2015 types and methods. Simply switching to the ES5 target currently generates a lot of tsc error messages. These are probably mostly addressable with available polyfills, but I don't have much expertise integrating them. @willpugh, are you sure you have the prerequisites installed? See CONTRIBUTING.md. There's a particular oddity in the required build order you may be running into, but I'm just now brushing the cobwebs out of my way so I don't remember the details too well. I think those files should have been generated during the Maven (mvn/Java) part of the build. |
O.K. Looked through this again. I think my pre-requisites are fine. However, when I go into reference/antlr4ts and run I get: I wonder if this is related to the root cause, and I need to get the JDK source code installed on my machine? I couldn't find instructions on this, but I'll see if I can just grab the source, and point that at it. . . |
Ahh, yes. I forgot about that, but it rings a bell. If I remember however there may be licensing challenges related to that. @sharwell would know better than me. |
@willpugh You can point it at any folder really. You only need Java source (maybe limited to Java 6 syntax) in it if you want to play with the performance tests. |
Hmm. I'm simply running but it seems to want to run the performance tests. The first error (of the hundreds I end up getting) is:
benchmark/TestPerformance.ts(61,40): error TS2307: Cannot find module './gen/std/JavaLexer'. This is after I JDK_SOURCE_ROOT set. My tools look like they are approriately setup: wpugh-mac2:antlr4ts wpugh$ npm -v wpugh-mac2:antlr4ts wpugh$ mvn -v |
That seems to confirm a similar problem in discussion on PR #252, which @carlansley submitted but closed before it got merged. That PR was supposed to be a Mac/Linux build issue fix, unfortunately I'm not very experienced in those environments. I'm setting up Travis CI to let me repro without a local Linux machine, and seem to succeeded in reproducing the same problem. |
Duplicate of #326 |
I'm getting an error when trying to "new" a generated file that extends Lexer.
I suspect the problem is that our project is compiled down from TS to ES5.
Is the NPM module delivered as ES6. Is there an ES5 variant? Has anyone else run into this?
The text was updated successfully, but these errors were encountered: