From c59e0e95f92779ce6bb3aab823d318bc16b20c33 Mon Sep 17 00:00:00 2001 From: bluelovers Date: Thu, 6 Feb 2020 21:40:07 +0800 Subject: [PATCH] fix: type `CryptoKeyPair` and rename to `IGunCryptoKeyPair` --- types/chain.d.ts | 6 +++--- types/types.d.ts | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/types/chain.d.ts b/types/chain.d.ts index 9a625473..b2b45593 100644 --- a/types/chain.d.ts +++ b/types/chain.d.ts @@ -1,4 +1,4 @@ -import { AlwaysDisallowedType, DisallowPrimitives, DisallowArray, AckCallback, ArrayOf, ArrayAsRecord, Saveable } from './types'; +import { AlwaysDisallowedType, DisallowPrimitives, DisallowArray, AckCallback, ArrayOf, ArrayAsRecord, Saveable, IGunCryptoKeyPair } from './types'; import { IGunConstructorOptions } from './options'; import { ITSResolvable } from 'ts-type'; export interface IGunChainReference, ReferenceKey = any, IsTop extends 'pre_root' | 'root' | false = false> { @@ -217,7 +217,7 @@ export interface IGunChainReference, ReferenceKey epub: string; pub: string; }; - sea: CryptoKeyPair; + sea: IGunCryptoKeyPair; soul: string; } | { err: string; @@ -225,7 +225,7 @@ export interface IGunChainReference, ReferenceKey /** * Returns the key pair in the form of an object as below. */ - pair(): CryptoKeyPair; + pair(): IGunCryptoKeyPair; /** * Log out currently authenticated user. Parameters are unused in the current implementation. * @param opt unused in current implementation. diff --git a/types/types.d.ts b/types/types.d.ts index a7e78399..fbe24c08 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -21,4 +21,17 @@ export declare type AckCallback = (ack: { err: undefined; ok: string; }) => void; -export declare type CryptoKeyPair = Record<'pub' | 'priv' | 'epub' | 'epriv', string>; +export declare type IGunCryptoKeyPair = Record<'pub' | 'priv' | 'epub' | 'epriv', string>; +export interface IGunRecordNodeRawBase { + '#': string; +} +export interface IGunRecordNodeRawExtra extends IGunRecordNodeRawBase { + '>': Record; +} +export interface IGunRecordNodeRaw { + '_': IGunRecordNodeRawExtra; +} +export declare type IGunRecordNode = { + [K in keyof DataType]: IGunRecordNodeRawBase; +} & IGunRecordNodeRaw; +export declare type IGunRecordData = DataType & IGunRecordNodeRaw;