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

[Enhancement] Type definition to work with TypeScript. #12

Closed
feliciss opened this issue Feb 26, 2020 · 3 comments
Closed

[Enhancement] Type definition to work with TypeScript. #12

feliciss opened this issue Feb 26, 2020 · 3 comments

Comments

@feliciss
Copy link

Is there a possible way to implement the type definition of gopherjs-libra to work with typescript?
I see such .d.ts generator dts-gen from microsoft can help to generate d.ts file from node or js library.

There is the generated d.ts file from gopherjs-libra.js.

 /** Declaration file generated by dts-gen */

export = gopherjs_libra;

declare const gopherjs_libra: {
    libra: {
        accountReceivedEventPath: any;
        accountResourcePath: any;
        accountSentEventPath: any;
        client: any;
        inferProgramName: any;
        pubkeyToAddress: any;
        resourcePath: any;
    };
};

However, the origin javascript file need to be a module (translate to ts file) or exported. I'm trying to implement that at this time.

@the729
Copy link
Owner

the729 commented Feb 26, 2020

It will be great to have gopherjs-libra work with typescript. I have little experience with js and even less with ts. To be honest I had spent several days to figure out how to make gopherjs transpiled code to work with both browsers and nodejs.

You can rebuild the js file using gopherjs without -m option, so that it will not be minimized. I guess this will help you figure out how gopherjs organize the output js code.

Good luck!

@feliciss
Copy link
Author

feliciss commented Mar 8, 2020

It will be great to have gopherjs-libra work with typescript. I have little experience with js and even less with ts. To be honest I had spent several days to figure out how to make gopherjs transpiled code to work with both browsers and nodejs.

You can rebuild the js file using gopherjs without -m option, so that it will not be minimized. I guess this will help you figure out how gopherjs organize the output js code.

Good luck!

It compatible with vue.js but react or react-js...

@the729
Copy link
Owner

the729 commented Mar 8, 2020

I'm not expert in js or ts. So I can't help you with this issue. Pull requests are welcome if anyone has figured out how to make it work with ts.

@the729 the729 closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants