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

[BUG] step.run return type becomes unknown #784

Open
FedericoBiccheddu opened this issue Dec 12, 2024 · 2 comments
Open

[BUG] step.run return type becomes unknown #784

FedericoBiccheddu opened this issue Dec 12, 2024 · 2 comments

Comments

@FedericoBiccheddu
Copy link

Describe the bug
Every step.run function returns unknown instead of the correct type.

I don't know the reason. I suspect it has something to do with unions or complex types.
I'm currently using effect and happens with Option, Either or Effect types.

To Reproduce
https://codesandbox.io/p/sandbox/inngest-run-returns-unknown-c49kdd

Expected behavior
It should return the same type as the step.run callback returns.

Code snippets / Logs / Screenshots
https://codesandbox.io/p/sandbox/inngest-run-returns-unknown-c49kdd

System info (please complete the following information):

  • Typescript Version 5.7.2
  • npm package Version 3.28.0

Additional context

Copy link

linear bot commented Dec 12, 2024

@FedericoBiccheddu
Copy link
Author

I believe my problem come from the incorrect assumption that step.run is a HOF and returns the return value of the parameter function. Upon reviewing the documentation, it seems that the result is expected to be or can be serialized.

Currently, I have mitigated the issue by using Schema.encode (where Schema serves as a decoder or encoder for data transmission over the wire) before returning the value. I have also updated the example with a working implementation.

If this is working as expected, it might be helpful to include more details in the documentation on why serialization is necessary or make it more explicit. For instance, Date are not serializable by default, so I assume there is a default "serializer" for common types (such as Date, BigInt, and so on).

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

1 participant