Fix errors

This commit is contained in:
Jack Works 2019-03-19 13:37:33 +08:00
parent fdc13d05d3
commit 15fac8e23b
No known key found for this signature in database
GPG Key ID: BA3AD1AA5ECAF521
2 changed files with 8 additions and 13 deletions

View File

@ -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());

View File

@ -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 <https://github.com/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<DataType> = Partial<DataType> | string | number | boolean | null | ChainReference<DataType>;
type AckCallback = (ack: { err: Error; ok: any } | { err: undefined; ok: string }) => void;
type Parameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? P : never;
interface ChainReference<DataType = any, ReferenceKey = any, IsTop extends 'pre_root' | 'root' | false = false> {
//#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';