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

Provide a way to import just types. #400

Closed
reitowo opened this issue Nov 23, 2024 · 2 comments
Closed

Provide a way to import just types. #400

reitowo opened this issue Nov 23, 2024 · 2 comments

Comments

@reitowo
Copy link

reitowo commented Nov 23, 2024

When use with electron is will be very inconvinience if we can't use enum types in renderer process, and there's not way to use that unless import this module, (not import type). Maybe we can provide a way to import just types, but not starting an dotnet runtime?

@jasongin
Copy link
Member

You can run the TS generator tool on the .NET assembly, which will output the TS types. I think it is generally not very useful to load those generated types into JS without also loading the .NET runtime. I understand just loading the enums could work, but that is of limited value. If you do need that, you can make a simple script to remove the other imports from the TS file or otherwise extract the enum parts that you need.

@reitowo
Copy link
Author

reitowo commented Jan 11, 2025

Like I said in #399, instead of import ts without dotnet runtime, it seems wiser to generate a seperated ts file that contains pure javascript types, to be used with JSON.parse, and without loading dotnet runtime.

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