Skip to content

Generate TypeScript or JavaScript source code #410

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

Closed
angularsen opened this issue Feb 13, 2018 · 4 comments
Closed

Generate TypeScript or JavaScript source code #410

angularsen opened this issue Feb 13, 2018 · 4 comments

Comments

@angularsen
Copy link
Owner

angularsen commented Feb 13, 2018

I think it would be awesome to reuse the code generator scripts to generate TypeScript and/or JavaScript code and get that published on NPM. I don't currently have a need for this myself and haven't looked into what already exists, but I imagine we have an opportunity to contribute something valuable here.

As a start, someone should figure out the structure of the generated code and what makes sense in those languages, and draft up a proposal in bullet form.

They key features are listed on the README front page. Static typing is obviously a win for TypeScript and other typed languages. Quantity representations (value+unit) and unit conversions seems obvious.
Quantity and unit parsing should be useful. The WPF sample app probably best resembles how this would be used in front-end web development.

Difficulty hard as it requires drafting up the architecture for an entirely new code base. You probably also need experience with modern front-end build tools like webpack and publishing proper packages to NPM, as well as figure out how our current code base and features can best be translated to a new language. Finally you need to modify our existing code generator scripts to output entirely new code.

Hard - but fun! :-)

Related: #409

@R2D221
Copy link

R2D221 commented Sep 14, 2018

Try checking Bridge.NET. You can compile the C# code into JavaScript and TypeScript definitions.

@angularsen
Copy link
Owner Author

Sounds awesome! Will look into it when I get back from vacation.

@angularsen
Copy link
Owner Author

angularsen commented Sep 21, 2018

This is really cool. I've only skimmed through the web pages and wiki, so if I understand it right it's basically translating your code to JS and shimming the parts of the .NET framework you are actually using with JS equivalent functions.

I can't help think you will run into issues when you are using less common parts of the .NET framework, and the JS dependency must be pretty huge to cover non-trivial parts of the .NET framework. I can't seem to find any information about the binary size you get when using this library and what limitations there are in what parts of the .NET framework you can use. I don't see any mention about webassembly, so I'm assuming they are not using anything similar to Blazor's mono/c# in the browser.

Do you know anything about how this would all work? I don't have much time to play with this these days, but it would be fun to see how much of UnitsNet would work out of the box and what walls we would run into.

@angularsen
Copy link
Owner Author

angularsen commented Dec 29, 2019

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

No branches or pull requests

2 participants