@types/sharedb 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. sharedb/README.md +1 -1
  2. sharedb/index.d.ts +11 -7
  3. sharedb/package.json +2 -2
sharedb/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for sharedb (https://github.com/share/sha
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sharedb.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 03 May 2022 16:31:36 GMT
11
+ * Last updated: Thu, 02 Jun 2022 18:01:29 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
sharedb/index.d.ts CHANGED
@@ -97,14 +97,11 @@ declare class sharedb extends EventEmitter {
97
97
  fn: (context: sharedb.middleware.ActionContextMap[A], callback: (err?: any) => void) => void,
98
98
  ): void;
99
99
 
100
- on(event: 'timing', callback: (type: string, time: number, request: any) => void): this;
101
- on(event: 'submitRequestEnd', callback: (error: Error, request: SubmitRequest) => void): this;
102
- on(event: 'error', callback: (err: Error) => void): this;
103
- on(event: 'send', callback: (agent: Agent, response: ShareDB.ServerResponseSuccess | ShareDB.ServerResponseError) => void): this;
100
+ on<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
101
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
104
102
 
105
- addListener(event: 'timing', callback: (type: string, time: number, request: any) => void): this;
106
- addListener(event: 'submitRequestEnd', callback: (error: Error, request: SubmitRequest) => void): this;
107
- addListener(event: 'error', callback: (err: Error) => void): this;
103
+ addListener<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
104
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
108
105
 
109
106
  getOps(agent: Agent, index: string, id: string, from: number, to: number, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
110
107
  getOpsBulk(agent: Agent, index: string, id: string, fromMap: Record<string, number>, toMap: Record<string, number>, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
@@ -143,6 +140,13 @@ declare namespace sharedb {
143
140
  type DBQueryMethod = (collection: string, query: any, fields: ProjectionFields, options: any, callback: DBQueryCallback) => void;
144
141
  type DBQueryCallback = (err: Error | null, snapshots: Snapshot[], extra?: any) => void;
145
142
 
143
+ interface BackendEventListenerMap {
144
+ error: (err: Error) => void;
145
+ send: (agent: Agent, response: ShareDB.ServerResponseSuccess | ShareDB.ServerResponseError) => void;
146
+ submitRequestEnd: (error: Error, request: SubmitRequest) => void;
147
+ timing: (type: string, time: number, request: any) => void;
148
+ }
149
+
146
150
  abstract class PubSub {
147
151
  private static shallowCopy(obj: any): any;
148
152
  protected prefix?: string;
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "TypeScript definitions for sharedb",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sharedb",
6
6
  "license": "MIT",
@@ -40,6 +40,6 @@
40
40
  },
41
41
  "scripts": {},
42
42
  "dependencies": {},
43
- "typesPublisherContentHash": "a7c66f7d4ca41d1a4423bd30c1789c77b975c80f599d4811fd699acbff6139ec",
43
+ "typesPublisherContentHash": "37f57c8f390e581233bacd93aafe070e7c8f911eb66d6d5d4cffc59385d19136",
44
44
  "typeScriptVersion": "3.9"
45
45
  }