Simpler typings

This commit is contained in:
Daniel Lugo 2021-09-16 11:50:27 -04:00
parent 986e247c99
commit dd79430e42
2 changed files with 12 additions and 6 deletions

View file

@ -323,7 +323,7 @@ const forge = () => {
/**
* @param {string} path
* @param {boolean=} afterMap
* @returns {GunT.GUNNode & Smith.GunSmithNode}
* @returns {Smith.GunSmithNode}
*/
function createReplica(path, afterMap = false) {
/** @type {(GunT.Listener|GunT.LoadListener)[]} */
@ -590,7 +590,7 @@ function createReplica(path, afterMap = false) {
let userReplicaCalled = false
/**
* @returns {GunT.UserGUNNode & Smith.GunSmithNode}
* @returns {Smith.UserSmithNode}
*/
function createUserReplica() {
if (userReplicaCalled) {
@ -600,7 +600,7 @@ function createUserReplica() {
const baseReplica = createReplica('$user')
/** @type {GunT.UserGUNNode & Smith.GunSmithNode} */
/** @type {Smith.UserSmithNode} */
const completeReplica = {
...baseReplica,
get _() {
@ -690,7 +690,7 @@ function createUserReplica() {
}
/**
* @typedef {GunT.GUNNode & Smith.GunSmithNode & { reforge(): void }} RootNode
* @typedef {Smith.GunSmithNode & { reforge(): void }} RootNode
*/
/**

View file

@ -3,7 +3,11 @@
*/
/// <reference path="GunT.ts" />
namespace Smith {
export interface GunSmithNode {
export interface GunSmithNode extends GunT.GUNNode {
/**
* @override
*/
get(key: string): GunSmithNode
/**
* @override
*/
@ -11,7 +15,7 @@ namespace Smith {
/**
* @override
*/
set(data: GunT.ValidDataValue, cb?: GunT.Callback): GunT.GUNNode
set(data: GunT.ValidDataValue, cb?: GunT.Callback): GunSmithNode
/**
* Gun will be restarted to force replication of data
* if needed.
@ -32,6 +36,8 @@ namespace Smith {
specialThen(): Promise<GunT.ListenerData>
}
export type UserSmithNode = GunSmithNode & GunT.UserGUNNode
export interface PendingPut {
cb: GunT.Callback
data: GunT.ValidDataValue