Simpler typings
This commit is contained in:
parent
986e247c99
commit
dd79430e42
2 changed files with 12 additions and 6 deletions
|
|
@ -323,7 +323,7 @@ const forge = () => {
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @param {boolean=} afterMap
|
* @param {boolean=} afterMap
|
||||||
* @returns {GunT.GUNNode & Smith.GunSmithNode}
|
* @returns {Smith.GunSmithNode}
|
||||||
*/
|
*/
|
||||||
function createReplica(path, afterMap = false) {
|
function createReplica(path, afterMap = false) {
|
||||||
/** @type {(GunT.Listener|GunT.LoadListener)[]} */
|
/** @type {(GunT.Listener|GunT.LoadListener)[]} */
|
||||||
|
|
@ -590,7 +590,7 @@ function createReplica(path, afterMap = false) {
|
||||||
let userReplicaCalled = false
|
let userReplicaCalled = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {GunT.UserGUNNode & Smith.GunSmithNode}
|
* @returns {Smith.UserSmithNode}
|
||||||
*/
|
*/
|
||||||
function createUserReplica() {
|
function createUserReplica() {
|
||||||
if (userReplicaCalled) {
|
if (userReplicaCalled) {
|
||||||
|
|
@ -600,7 +600,7 @@ function createUserReplica() {
|
||||||
|
|
||||||
const baseReplica = createReplica('$user')
|
const baseReplica = createReplica('$user')
|
||||||
|
|
||||||
/** @type {GunT.UserGUNNode & Smith.GunSmithNode} */
|
/** @type {Smith.UserSmithNode} */
|
||||||
const completeReplica = {
|
const completeReplica = {
|
||||||
...baseReplica,
|
...baseReplica,
|
||||||
get _() {
|
get _() {
|
||||||
|
|
@ -690,7 +690,7 @@ function createUserReplica() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {GunT.GUNNode & Smith.GunSmithNode & { reforge(): void }} RootNode
|
* @typedef {Smith.GunSmithNode & { reforge(): void }} RootNode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@
|
||||||
*/
|
*/
|
||||||
/// <reference path="GunT.ts" />
|
/// <reference path="GunT.ts" />
|
||||||
namespace Smith {
|
namespace Smith {
|
||||||
export interface GunSmithNode {
|
export interface GunSmithNode extends GunT.GUNNode {
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
get(key: string): GunSmithNode
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
|
|
@ -11,7 +15,7 @@ namespace Smith {
|
||||||
/**
|
/**
|
||||||
* @override
|
* @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
|
* Gun will be restarted to force replication of data
|
||||||
* if needed.
|
* if needed.
|
||||||
|
|
@ -32,6 +36,8 @@ namespace Smith {
|
||||||
specialThen(): Promise<GunT.ListenerData>
|
specialThen(): Promise<GunT.ListenerData>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type UserSmithNode = GunSmithNode & GunT.UserGUNNode
|
||||||
|
|
||||||
export interface PendingPut {
|
export interface PendingPut {
|
||||||
cb: GunT.Callback
|
cb: GunT.Callback
|
||||||
data: GunT.ValidDataValue
|
data: GunT.ValidDataValue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue