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

Improve render functions return types #189

Closed
art049 opened this issue Sep 15, 2022 · 1 comment · Fixed by #199
Closed

Improve render functions return types #189

art049 opened this issue Sep 15, 2022 · 1 comment · Fixed by #199

Comments

@art049
Copy link

art049 commented Sep 15, 2022

Hey, thanks a lot for this library!

Is your feature request related to a problem? Please describe.
When using the lib with typescript, calling render will return the union string | Promise<string> | void whatever the call arguments are.
This is painful as using the library results always results in an unnecessary cast:

const rendered = Eta.render(template, {}) as string

From what I see in the code, the same problem applies to renderAsync, renderFile and renderFileAsync

Describe the solution you'd like
It should be possible to overload the function types to allow better-returned types

@shadowtime2000
Copy link
Collaborator

Will look more into this 👍

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

Successfully merging a pull request may close this issue.

2 participants