mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
fix(sharedb): correct sharedb.DB.getOps so it has nullable arguments (#42331)
* Update typings: getOps can have null from or to The docs for ShareDB clearly state that `from` and `to` arguments in `getOps` are nullable: > - `from` number: the first op version to fetch. If set to null, then ops will be fetched from the earliest version > - `to` number: The last op version. This version will not be fetched (ie to is non-inclusive). If set to null, then ops will be fetched up to the latest version * Add tests and name "Definitions by" Co-authored-by: petertravelchime <54869620+petertravelchime@users.noreply.github.com>
This commit is contained in:
5
types/sharedb/index.d.ts
vendored
5
types/sharedb/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/share/sharedb
|
||||
// Definitions by: Steve Oney <https://github.com/soney>
|
||||
// Eric Hwang <https://github.com/ericyhwang>
|
||||
// Peter Xu <https://github.com/pxpeterxu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
@@ -65,8 +66,8 @@ declare namespace sharedb {
|
||||
commit(collection: string, id: string, op: Op, snapshot: any, options: any, callback: (...args: any[]) => any): void;
|
||||
getSnapshot(collection: string, id: string, fields: any, options: any, callback: (...args: any[]) => any): void;
|
||||
getSnapshotBulk(collection: string, ids: string, fields: any, options: any, callback: (...args: any[]) => any): void;
|
||||
getOps(collection: string, id: string, from: number, to: number, options: any, callback: (...args: any[]) => any): void;
|
||||
getOpsToSnapshot(collection: string, id: string, from: number, snapshot: number, options: any, callback: (...args: any[]) => any): void;
|
||||
getOps(collection: string, id: string, from: number | null, to: number | null, options: any, callback: (...args: any[]) => any): void;
|
||||
getOpsToSnapshot(collection: string, id: string, from: number | null, snapshot: number, options: any, callback: (...args: any[]) => any): void;
|
||||
getOpsBulk(collection: string, fromMap: any, toMap: any, options: any, callback: (...args: any[]) => any): void;
|
||||
getCommittedOpVersion(collection: string, id: string, snapshot: any, op: any, options: any, callback: (...args: any[]) => any): void;
|
||||
query: DBQueryMethod;
|
||||
|
||||
@@ -40,6 +40,11 @@ const backend = new ShareDB({
|
||||
extraDbs: {myDb: new CustomExtraDb()}
|
||||
});
|
||||
console.log(backend.db);
|
||||
|
||||
// getOps allows for `from` and `to` to both be `null`:
|
||||
// https://github.com/share/sharedb/blob/960f5d152f6a8051ed2dcb00a57681a3ebbd7dc2/README.md#getops
|
||||
backend.db.getOps('someCollection', 'someId', null, null, {}, () => {});
|
||||
|
||||
console.log(backend.pubsub);
|
||||
console.log(backend.extraDbs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user