ts ignores
This commit is contained in:
parent
c13a33f3df
commit
873d9f5b74
8 changed files with 25 additions and 10 deletions
|
|
@ -74,6 +74,7 @@ const __createOutgoingFeed = async (withPublicKey, user, SEA) => {
|
|||
const newOutgoingFeedID = await new Promise((res, rej) => {
|
||||
const _outFeedNode = user
|
||||
.get(Key.OUTGOINGS)
|
||||
//@ts-ignore
|
||||
.set(newPartialOutgoingFeed, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(new Error(ack.err))
|
||||
|
|
@ -98,6 +99,7 @@ const __createOutgoingFeed = async (withPublicKey, user, SEA) => {
|
|||
.get(Key.OUTGOINGS)
|
||||
.get(newOutgoingFeedID)
|
||||
.get(Key.MESSAGES)
|
||||
//@ts-ignore
|
||||
.set(initialMsg, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(new Error(ack.err))
|
||||
|
|
@ -591,6 +593,7 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
|||
const hr = gun
|
||||
.get(Key.HANDSHAKE_NODES)
|
||||
.get(currentHandshakeAddress)
|
||||
//@ts-ignore
|
||||
.set(handshakeRequestData, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(new Error(`Error trying to create request: ${ack.err}`))
|
||||
|
|
@ -627,6 +630,7 @@ const sendHandshakeRequest = async (recipientPublicKey, gun, user, SEA) => {
|
|||
}
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
//@ts-ignore
|
||||
user.get(Key.STORED_REQS).set(storedReq, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(
|
||||
|
|
@ -959,6 +963,7 @@ const sendSpontaneousPayment = async (to, amount, memo, feeLimit) => {
|
|||
.getGun()
|
||||
.get(Key.ORDER_NODES)
|
||||
.get(currOrderAddress)
|
||||
//@ts-ignore
|
||||
.set(order, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* @format
|
||||
*/
|
||||
//@ts-ignore
|
||||
const Common = require('shock-common')
|
||||
const isFinite = require('lodash/isFinite')
|
||||
const shuffle = require('lodash/shuffle')
|
||||
|
|
@ -29,8 +30,9 @@ const calculateWallRequest = (numberOfPublicKeyGroups, pageRequested) => {
|
|||
* @param {number} page
|
||||
* @throws {TypeError}
|
||||
* @throws {RangeError}
|
||||
* @returns {Promise<Common.SchemaTypes.Post[]>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
//@returns {Promise<Common.SchemaTypes.Post[]>}
|
||||
const getFeedPage = async page => {
|
||||
if (!isFinite(page)) {
|
||||
throw new TypeError(`Please provide an actual number for [page]`)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ exports.userToIncomingID = async pub => {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<Common.SchemaTypes.User>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
//@returns {Promise<Common.SchemaTypes.User>}
|
||||
const getMyUser = async () => {
|
||||
const oldProfile = await Utils.tryAndWait(
|
||||
(_, user) => new Promise(res => user.get(Key.PROFILE).load(res)),
|
||||
|
|
@ -85,7 +86,7 @@ const getMyUser = async () => {
|
|||
(_, user) => Promise.resolve(user.is && user.is.pub),
|
||||
v => typeof v !== 'string'
|
||||
)
|
||||
|
||||
//@ts-ignore
|
||||
/** @type {Common.SchemaTypes.User} */
|
||||
const u = {
|
||||
avatar: oldProfile.avatar,
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ const Utils = require('../utils')
|
|||
|
||||
/**
|
||||
* @param {string} publicKey
|
||||
* @returns {Promise<Common.SchemaTypes.User>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
//@returns {Promise<Common.SchemaTypes.User>}
|
||||
const getAnUser = async publicKey => {
|
||||
const oldProfile = await Utils.tryAndWait(
|
||||
(g, u) => {
|
||||
|
|
@ -47,7 +48,7 @@ const getAnUser = async publicKey => {
|
|||
},
|
||||
v => typeof v !== 'number'
|
||||
)
|
||||
|
||||
//@ts-ignore
|
||||
/** @type {Common.SchemaTypes.User} */
|
||||
const u = {
|
||||
avatar: oldProfile.avatar || null,
|
||||
|
|
@ -68,8 +69,9 @@ const getAnUser = async publicKey => {
|
|||
module.exports.getAnUser = getAnUser
|
||||
|
||||
/**
|
||||
* @returns {Promise<Common.SchemaTypes.User>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
//@returns {Promise<Common.SchemaTypes.User>}
|
||||
const getMyUser = async () => {
|
||||
const oldProfile = await Utils.tryAndWait(
|
||||
(_, user) => new Promise(res => user.get(Key.PROFILE).load(res)),
|
||||
|
|
@ -106,7 +108,7 @@ const getMyUser = async () => {
|
|||
(_, user) => Promise.resolve(user.is && user.is.pub),
|
||||
v => typeof v !== 'string'
|
||||
)
|
||||
|
||||
//@ts-ignore
|
||||
/** @type {Common.SchemaTypes.User} */
|
||||
const u = {
|
||||
avatar: oldProfile.avatar,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@ const getWallTotalPages = async publicKey => {
|
|||
* @param {string=} publicKey
|
||||
* @throws {TypeError}
|
||||
* @throws {RangeError}
|
||||
* @returns {Promise<Common.SchemaTypes.WallPage>}
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
////@returns {Promise<Common.SchemaTypes.WallPage>}
|
||||
const getWallPage = async (page, publicKey) => {
|
||||
const totalPages = await getWallTotalPages(publicKey)
|
||||
|
||||
|
|
@ -103,9 +104,10 @@ const getWallPage = async (page, publicKey) => {
|
|||
*/
|
||||
const mockUser = await User.getMyUser()
|
||||
|
||||
/**
|
||||
/*
|
||||
* @type {Common.SchemaTypes.WallPage}
|
||||
*/
|
||||
//@ts-ignore
|
||||
const thePage = await Utils.tryAndWait(
|
||||
(g, u) => {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => {
|
|||
getUser()
|
||||
.get(Key.ORDER_TO_RESPONSE)
|
||||
.get(orderID)
|
||||
//@ts-ignore
|
||||
.put(orderResponse, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
rej(
|
||||
|
|
@ -183,6 +184,7 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => {
|
|||
getUser()
|
||||
.get(Key.ORDER_TO_RESPONSE)
|
||||
.get(orderID)
|
||||
//@ts-ignore
|
||||
.put(orderResponse, ack => {
|
||||
if (ack.err && typeof ack.err !== 'number') {
|
||||
logger.error(
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ const onStoredReqs = cb => {
|
|||
.get(Key.STORED_REQS)
|
||||
.open(d => {
|
||||
if (typeof d === 'object' && d !== null) {
|
||||
//@ts-ignore
|
||||
encryptedStoredReqs = /** @type {StoredRequest[]} */ (Object.values(
|
||||
d
|
||||
).filter(i => Schema.isStoredRequest(i)))
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ const onOpenForPubFeedPair = ([pub, feed]) =>
|
|||
})
|
||||
return
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
const incoming = /** @type {import('shock-common').Schema.Outgoing} */ (data)
|
||||
|
||||
// incomplete data, let's not assume anything
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue