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

Feature Request: Generate Classes instead of interfaces #544

Closed
mattbishop opened this issue Jul 31, 2023 · 2 comments
Closed

Feature Request: Generate Classes instead of interfaces #544

mattbishop opened this issue Jul 31, 2023 · 2 comments

Comments

@mattbishop
Copy link

mattbishop commented Jul 31, 2023

Typescript interfaces are really nice, but some use cases require a Class instead of an interface, especially working with libraries that need classes for data handling. Simple class generation shouldn't be that hard, right?

Also, class generation opens up the possibility of more advanced features like field validation in the setters.

@bcherny
Copy link
Owner

bcherny commented Sep 23, 2023

Feel free to write your own generator to do this. You'd want to fork the compile function in your code, replacing this call to generate() with your own generate function.

@galah92
Copy link

galah92 commented Sep 26, 2023

@mattbishop what did you end up doing?
@bcherny will you accept a PR adding optional parameter to support generation of types instead of interfaces?

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

3 participants