Skip to content
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

Syntax error when using for typescript definitions #40

Open
arnarthor opened this issue Aug 30, 2017 · 8 comments
Open

Syntax error when using for typescript definitions #40

arnarthor opened this issue Aug 30, 2017 · 8 comments
Labels
Projects

Comments

@arnarthor
Copy link

Description

Tried running retyped compile for raven-js typescript definitions resulting in the following error.

retyped compile node_modules/raven-js/typescript/raven.d.ts
Error: File "", line 49, characters 29-36:
313: <SYNTAX ERROR>

    at Object.compile (/usr/local/lib/node_modules/reasonably-typed/lib/index.js:49:11)
    at fs.readFile.e (/usr/local/lib/node_modules/reasonably-typed/lib/cli.js:86:40)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)

Step to reproduce

  • install retyped 0.11.0
  • install bs-platform 1.9.1
  • yarn add -E [email protected]
  • retyped compile node_modules/raven-js/typescript/raven.d.ts

Setup details

retyped --version
0.11.0
bsc -version
BuckleScript 1.9.1 (Using OCaml4.02.3+BS )

If you need more details you can ping me on Discord (@arnar) or this issue 👍

@rrdelaney
Copy link
Owner

Looks like this is an upstream issue in Flowgen. We have our own Flowgen fork, reasonable-flowgen.

@mrmurphy
Copy link

Another instance of what's probably the same issue, while trying to run the parser on https://github.com/firebase/firebase-js-sdk/blob/master/packages/firebase/index.d.ts

Error: Parse_error.Error: undefined
    at Object.compile (/Users/murphy/.nvm/versions/node/v8.9.4/lib/node_modules/reasonably-typed/lib/index.js:60:11)
    at fs.readFile (/Users/murphy/.nvm/versions/node/v8.9.4/lib/node_modules/reasonably-typed/lib/cli.js:56:40)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
retyped --version
0.13.0

@zploskey
Copy link
Contributor

zploskey commented Mar 2, 2018

It looks like the dependency on flowgen and even checking if the file is a typescript file was removed in c18c12a. As it is, it is trying to parse the typescript definitions as flow types. Was this intentional? Should we add back flowgen or reasonable-flowgen, or was there a different approach in mind?

@rrdelaney
Copy link
Owner

Now that ReasonablyTyped is compiling with BuckleScript, we can start to use JS libraries, specifically the TS parser. Look for ReasonablyTyped-native TS support coming soon 😁

This means there's some new areas for help, and some new issues I have to create. If anyone is looking for contribution opportunities though, BuckleScript bindings to the TS API would be awesome!

@zploskey
Copy link
Contributor

zploskey commented Mar 3, 2018

I've been writing a ton of bindings lately. If you can point me at the specific interfaces that are highest priority for you I could start with those.

@rrdelaney rrdelaney removed the flowgen label Mar 25, 2018
@rrdelaney
Copy link
Owner

@zploskey I'm working on bindings to the TS compiler in bindings/typescript.re. Here's a pretty good example on how to expose an AST node to Reason: 5046d9d. I'm using AST Explorer for debugging what nodes have what that are actually useful to ReasonablyTyped.

@digitake
Copy link

Are there any simple way to make it works with TypeScript for now?
I have tried to contribute but I have no idea which part to start. Ideally, I want to focus on make it works with TypeScript because it seems like there are lots of TypeScript lib compared to flow.

@rrdelaney
Copy link
Owner

@digitake check out the 2 directory in the root of the project 🙂 that’s the future of the project, and it should be more clear what’s going on in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

5 participants