fix: accept readonly arrays for webhook eventTypes input#931
Merged
Conversation
eventTypes
barjin
approved these changes
Jun 4, 2026
`WebhookUpdateData.eventTypes` (the input to `create()` / `update()`) now accepts a `readonly WebhookEventType[]`. The client never mutates the array, and `readonly T[]` still accepts a plain `T[]`, so existing callers are unaffected — but callers holding a `readonly` array (e.g. the Apify SDK's `WebhookOptions`) can pass it without copying first. The `Webhook` response type keeps `eventTypes` mutable, so reading webhooks is unchanged — this is input-only and not a breaking change.
d89cb55 to
2cd184b
Compare
eventTypeseventTypes input
B4nan
added a commit
to apify/apify-sdk-js
that referenced
this pull request
Jun 4, 2026
apify-client 2.23.4 types `WebhookUpdateData.eventTypes` as a readonly array (apify/apify-client-js#931), so `Actor.addWebhook` can spread the readonly `WebhookOptions.eventTypes` straight into `create()` without copying it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebhookUpdateData.eventTypes— the input tocreate()/update()— now accepts areadonly WebhookEventType[]. TheWebhookresponse type keepseventTypesmutable, so this is input-only and not a breaking change for code that reads webhooks.The client never mutates the array (it only appears in type declarations), and a
readonly T[]still accepts a plain mutableT[], so:['ACTOR.RUN.SUCCEEDED']tocreate()/update()keeps working.readonlyarray can now pass it directly. The Apify SDK typesWebhookOptions.eventTypesasreadonly WebhookEventType[], so it currently copies the array (eventTypes: [...options.eventTypes]) just to satisfy this client's mutable input type. With this change the copy goes away.Emitted types after the change:
Type-only change; no runtime behavior changes.
tscbuild + lint pass.🤖 Generated with Claude Code