From 15fac8e23bdc87dfcedb1536b2aec6c4b6399bad Mon Sep 17 00:00:00 2001 From: Jack Works Date: Tue, 19 Mar 2019 13:37:33 +0800 Subject: [PATCH] Fix errors --- types/gun/gun-tests.ts | 14 ++++---------- types/gun/index.d.ts | 7 ++++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/types/gun/gun-tests.ts b/types/gun/gun-tests.ts index 3c9eb0e55e..e399414e0a 100644 --- a/types/gun/gun-tests.ts +++ b/types/gun/gun-tests.ts @@ -108,13 +108,7 @@ bad.get('b') // $ExpectError .put(X); -bad.get('b').put({ - // $ExpectError - c: () => {}, - // $ExpectError - d: X, - // $ExpectError - e: { - f: () => {} - } -}); +// $ExpectError +bad.get('b').put({ c: () => {}, d: X, e: { f: () => {} } }); +// $ExpectError +bad.get('c').put(new X()); diff --git a/types/gun/index.d.ts b/types/gun/index.d.ts index 176521acaa..0cba9d6620 100644 --- a/types/gun/index.d.ts +++ b/types/gun/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for gun 0.9.9999991 +// Type definitions for gun 0.9 // Project: https://github.com/amark/gun#readme // Definitions by: Jack Works // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 +// TypeScript Version: 3.1 declare const cons: Gun.Constructor; export = cons; @@ -69,6 +69,7 @@ declare namespace Gun { }>; type Saveable = Partial | string | number | boolean | null | ChainReference; type AckCallback = (ack: { err: Error; ok: any } | { err: undefined; ok: string }) => void; + type Parameters any> = T extends (...args: infer P) => any ? P : never; interface ChainReference { //#region API /** @@ -407,7 +408,7 @@ declare namespace Gun { work( data: any, pair?: any, - callback?: (data: string | void) => void, + callback?: (data: string | undefined) => void, opt?: Partial<{ name: 'SHA-256' | 'PBKDF2'; encode: 'base64' | 'base32' | 'base16';