Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Remove Partial<> from Parameterised type for Worker (complete.success) #198

Closed
jwulf opened this issue Dec 14, 2020 · 0 comments · Fixed by #199
Closed

Remove Partial<> from Parameterised type for Worker (complete.success) #198

jwulf opened this issue Dec 14, 2020 · 0 comments · Fixed by #199
Assignees
Labels
breaking change investigation An issue that requires investigative work

Comments

@jwulf
Copy link
Member

jwulf commented Dec 14, 2020

At the moment, the worker completion payload is a Partial. However, this erases type safety for required parameters.

If a programmer really has a Partial, they can put that in the signature.

Changing this will break the compilation of any code that uses type parameters on createWorker, if it relies on the existing implicit Partial<T>.

I don't think many people are using that at the moment - I'll check in Slack.

The benefit of making this change for type safety is significant, and the refactoring to fix the breaking change in users' code is T -> Partial<T> which is minimal and deterministic.

For example:

zbc.createWorker<INpmPackageQuery, {}, IndividualResult>

if the worker really returns only part of the IndividualResult type, it will need to be refactored to:

zbc.createWorker<INpmPackageQuery, {}, Partial<IndividualResult>>

The change needs to be made here: https://github.com/zeebe-io/zeebe-client-node-js/blob/master/src/lib/ZBWorkerBase.ts#L275

@jwulf jwulf changed the title Remove Partial<> from Parameterised types on inputs and outputs to Worker Remove Partial<> from Parameterised type for Worker (complete.success) Dec 14, 2020
@jwulf jwulf self-assigned this Dec 14, 2020
@jwulf jwulf added investigation An issue that requires investigative work breaking change labels Dec 14, 2020
@jwulf jwulf closed this as completed in #199 Feb 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change investigation An issue that requires investigative work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant