sdk-typescript icon indicating copy to clipboard operation
sdk-typescript copied to clipboard

Fix argument validation in WorkflowHandle for issue #1327

Open Vignesh18280 opened this issue 1 year ago • 3 comments

#1327

What was changed This PR fixes the argument validation for WorkflowHandle. It ensures that the args parameter is always validated as an array and throws an appropriate error if it is not.

Why? To address issue #1327, improving error handling and clarity for users by ensuring the args passed to workflows are always arrays.

Vignesh18280 avatar Sep 23 '24 14:09 Vignesh18280

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 23 '24 14:09 CLAassistant

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Sep 23 '24 14:09 CLAassistant

Thanks for your contribution.

Can you please clarify the use case that would result in seeing this error message?

The TypeScript signature for that function no longer allows passing a non-array to args, and we generally do not add type checking for pure JS use cases.

mjameswh avatar Sep 24 '24 18:09 mjameswh

@mjameswh Thanks for the response. It's true that TypeScript enforces array inputs for args. However, since the issue remained open, I assumed that Temporal wanted to implement additional error handling for potential edge cases, particularly in JavaScript environments where type safety isn't as strict. I aimed to add that validation to ensure better runtime safety. Let me know if this approach aligns with the goal!

Vignesh18280 avatar Sep 25 '24 04:09 Vignesh18280

I see. Then thanks again, but I'd prefer not changing this.

mjameswh avatar Sep 25 '24 17:09 mjameswh