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

Evalulate function limited to number? #165

Open
Gillardo opened this issue Jun 25, 2018 · 1 comment
Open

Evalulate function limited to number? #165

Gillardo opened this issue Jun 25, 2018 · 1 comment
Labels

Comments

@Gillardo
Copy link
Contributor

Why is the Evalulate function limited to returning a number (i am using typescript) and not any object? I would like to calculate the difference between 2 dates and write my own DATEADD and DATEDIFF functions.

Is this not possible in this library?

@silentmatt silentmatt added the bug label Jun 25, 2018
@silentmatt
Copy link
Owner

The support for objects is very limited at the moment, but technically there's nothing preventing you from returning one from an expression other than the TypeScript type definition. There's just not much you can do with them within an expression other than passing them to or returning them from custom functions.

I haven't used TypeScript personally, so there's a good chance the type definitions are wrong in other places as well. It's something I'm hoping to address with the next major version, since fixing it will probably involve breaking changes.

I'm not familiar enough with TypeScript to offer a good workaround, so forking the project and changing the return type to any might be the best alternative until it's fixed.

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

No branches or pull requests

2 participants