From 245c1295e5a51cc7653aaadbe39b4b15304f6639 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 24 Feb 2021 19:55:25 +0100 Subject: [PATCH] Fix JSDoc return type annotations of async functions These don't return the mentioned type directly, but a promise containing this type, which has to be await'ed first. This was confusing my IDE's tslint which suggested await would not be necessary. --- src/api.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api.js b/src/api.js index e04b654..23648d0 100644 --- a/src/api.js +++ b/src/api.js @@ -23,7 +23,7 @@ const fetchApi = (path, params = {}) => { /** * Get the recorder's version. * - * @returns {String} Version + * @returns {Promise} Version */ export const getVersion = async () => { const response = await fetchApi("/api/0/version"); @@ -36,7 +36,7 @@ export const getVersion = async () => { /** * Get all users. * - * @returns {User[]} Array of usernames + * @returns {Promise} Array of usernames */ export const getUsers = async () => { const response = await fetchApi("/api/0/list"); @@ -50,7 +50,7 @@ export const getUsers = async () => { * Get all devices for the provided users. * * @param {User[]} users Array of usernames - * @returns {{User: Device[]}} + * @returns {Promise<{User: Device[]}>} * Object mapping each username to an array of device names */ export const getDevices = async (users) => { @@ -80,7 +80,7 @@ export const getDevices = async (users) => { * * @param {User} [user] Get last locations of all devices from this user * @param {Device} [device] Get last location of specific device - * @returns {OTLocation[]} Array of last location objects + * @returns {Promise} Array of last location objects */ export const getLastLocations = async (user, device) => { const params = {}; @@ -107,7 +107,7 @@ export const getLastLocations = async (user, device) => { * @param {Device} device Device name * @param {String} start Start date and time in UTC * @param {String} end End date and time in UTC - * @returns {OTLocation[]} Array of location history objects + * @returns {Promise} Array of location history objects */ export const getUserDeviceLocationHistory = async ( user, @@ -141,7 +141,7 @@ export const getUserDeviceLocationHistory = async ( * Devices of which the history should be fetched * @param {String} start Start date and time in UTC * @param {String} end End date and time in UTC - * @returns {LocationHistory} Location history + * @returns {Promise} Location history */ export const getLocationHistory = async (devices, start, end) => { const locationHistory = {};