From 2168e3e2d729076818f3a0b5730839148f9ee939 Mon Sep 17 00:00:00 2001 From: nsreed Date: Mon, 12 Apr 2021 01:58:38 -0400 Subject: [PATCH] add options argument to set/put method signatures (#1067) * chain.d.ts: add options argument to put & set * chain.d.ts: set cb may be null when providing opts Co-authored-by: Norman Reed --- types/chain.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/chain.d.ts b/types/chain.d.ts index 734004fc..c8dda1d8 100644 --- a/types/chain.d.ts +++ b/types/chain.d.ts @@ -15,8 +15,9 @@ export interface IGunChainReference, ReferenceKey * * Traditional arrays are dangerous in real-time apps. Use `gun.set` instead. * * @param callback invoked on each acknowledgment + * @param options additional options (used for specifying certs) */ - put(data: Partial>>>, callback?: AckCallback): IGunChainReference; + put(data: Partial>>>, callback?: AckCallback|null, options?: {opt?:{cert?:string}}): IGunChainReference; /** * Where to read data from. * @param key The key is the ID or property name of the data that you saved from earlier @@ -80,11 +81,14 @@ export interface IGunChainReference, ReferenceKey * If the item is added twice, it will be merged. * * **This means only objects, for now, are supported.** + * @param data the object to add to the set + * @param callback optional function to invoke when the operation is complete + * @param options additional options (used for specifying certs) */ set(data: AlwaysDisallowedType ? U extends { [key: string]: any; [key: number]: any; - } ? ArrayOf : never : never>, callback?: AckCallback): IGunChainReference>; + } ? ArrayOf : never : never>, callback?: AckCallback|null, options?: {opt?:{cert?:string}}): IGunChainReference>; /** * Map iterates over each property and item on a node, passing it down the chain, * behaving like a forEach on your data.