Object -> object in JS type hints

And other minor JS comment fixes
This commit is contained in:
Andrew Ferrazzutti 2022-05-15 22:21:49 -04:00
parent 27b2c15ad3
commit 2cd7697aa5
1 changed files with 43 additions and 42 deletions

View File

@ -43,7 +43,7 @@ const { KnownChatType } = chat
import { emitLines, promisify } from "./util.js"
/**
* @typedef {Object} ChannelProps
* @typedef {object} ChannelProps
* @property {Long} id
* @property {ChannelType} type
*/
@ -80,6 +80,7 @@ class PermError extends ProtocolError {
/**
* @param {?OpenChannelUserPerm[]} permNeeded
* @param {?OpenChannelUserPerm} permActual
* @param {string} action
*/
constructor(permNeeded, permActual, action) {
const who =
@ -515,10 +516,10 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.passcode
* @param {string} req.uuid
* @param {Object} req.form
* @param {object} req.form
*/
registerDevice = async (req) => {
// TODO Look for a deregister API call
@ -528,9 +529,9 @@ export default class PeerClient {
/**
* Obtain login tokens. If this fails due to not having a device, also request a device passcode.
* @param {Object} req
* @param {object} req
* @param {string} req.uuid
* @param {Object} req.form
* @param {object} req.form
* @param {boolean} req.forced
* @returns The response of the login attempt, including obtained
* credentials for subsequent token-based login. If a required device passcode
@ -584,7 +585,7 @@ export default class PeerClient {
* @param {string} mxid
* @param {ChannelProps} channelProps
* @param {?OpenChannelUserPerm[]} permNeeded If set, throw if the user's permission level matches none of the values in this list.
* @param {?string} action The action requiring permission, to be used in an error message if throwing..
* @param {?string} action The action requiring permission, to be used in an error message if throwing.
* @throws {PermError} if the user does not have the specified permission level.
*/
async #getUserChannel(mxid, channelProps, permNeeded, action) {
@ -600,7 +601,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {OAuthCredential} req.oauth_credential
*/
@ -615,7 +616,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {OAuthCredential} req.oauth_credential
*/
@ -634,7 +635,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
userStop = async (req) => {
@ -643,7 +644,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {?OAuthCredential} req.oauth_credential
*/
@ -652,7 +653,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
handleDisconnect = (req) => {
@ -660,7 +661,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
isConnected = (req) => {
@ -668,7 +669,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
getSettings = async (req) => {
@ -692,7 +693,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
getOwnProfile = async (req) => {
@ -700,7 +701,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {Long} req.user_id
*/
@ -709,7 +710,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
*/
@ -733,7 +734,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
*/
@ -767,7 +768,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
*/
@ -777,7 +778,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {?Long} req.sync_from
@ -804,7 +805,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {[Long]} req.unread_chat_ids Must be in DECREASING order
@ -834,7 +835,7 @@ export default class PeerClient {
}
/**
* @typedef {Object} Receipt
* @typedef {object} Receipt
* @property {Long} userId
* @property {Long} chatId
*/
@ -845,7 +846,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {string} req.uuid
*/
@ -854,7 +855,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {string} req.uuid
*/
@ -868,7 +869,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {boolean} req.searchable
*/
@ -890,7 +891,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
listFriends = async (req) => {
@ -898,7 +899,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {Long} req.user_id
* @param {boolean} req.add
@ -912,7 +913,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {string} req.uuid
* @param {boolean} req.add
@ -949,7 +950,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid The user whose friend is being looked up.
* @param {string} req.friend_id The friend to search for.
* @param {string} propertyName The property to retrieve from the specified friend.
@ -962,7 +963,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
*/
getMemoIds = (req) => {
@ -979,7 +980,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {string} req.key
@ -994,7 +995,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {string} req.text
@ -1013,7 +1014,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {int} req.type
@ -1037,7 +1038,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {Long} req.chat_id
@ -1051,7 +1052,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {Long} req.read_until_chat_id
@ -1065,7 +1066,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {Long} req.user_id
@ -1089,7 +1090,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {string} req.name
@ -1105,7 +1106,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {string} req.description
@ -1122,7 +1123,7 @@ export default class PeerClient {
/*
* TODO
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
* @param {string} req.photo_url
@ -1141,7 +1142,7 @@ export default class PeerClient {
*/
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {Long} req.user_id
*/
@ -1173,7 +1174,7 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.mxid
* @param {ChannelProps} req.channel_props
*/
@ -1191,9 +1192,9 @@ export default class PeerClient {
}
/**
* @param {Object} req
* @param {object} req
* @param {string} req.peer_id
* @param {Object} req.register_config
* @param {object} req.register_config
* @param {string} req.register_config.device_name
*/
handleRegister = async (req) => {