mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
update(simperium): add missing optional parameters to event listener (#45814)
When creating the original types there was an oversight in the event types for the `Channel` and its `update` event. In some cases the event fires only with the first two parameters: the entity id and data. In the normative case however there are additional parameters available indicating meta information about the update. Those optional paramters have been added here. Although it looks like all three of the last parameters are optional it's actually the case that either you get only the first two or all five. It would not occur that you only get three or four of them but I wasn't sure how to type this beyond function overloads and I believe that it's not the best idea to use function overloads for optional parameters.
This commit is contained in:
parent
b9f4e2353b
commit
6c2bcffe68
8
types/simperium/index.d.ts
vendored
8
types/simperium/index.d.ts
vendored
@ -179,7 +179,13 @@ interface ChannelEvent<T> extends SimperiumEvent {
|
||||
indexingStateChange: (isIndexing: boolean) => void;
|
||||
ready: () => void;
|
||||
send: (message: string) => void;
|
||||
update: (entityId: EntityId, updatedEntity: T) => void;
|
||||
update: (
|
||||
entityId: EntityId,
|
||||
updatedEntity: T,
|
||||
originalEntity?: T,
|
||||
patch?: JSONDiff<T>,
|
||||
isIndexing?: boolean,
|
||||
) => void;
|
||||
version: (entityId: EntityId, version: number, entity: T) => void;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user