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.
This commit is contained in:
Linus Groh
2021-02-24 20:07:47 +01:00
parent 9786487646
commit 245c1295e5
+6 -6
View File
@@ -23,7 +23,7 @@ const fetchApi = (path, params = {}) => {
/**
* Get the recorder's version.
*
* @returns {String} Version
* @returns {Promise<String>} 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<User[]>} 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<OTLocation[]>} 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<OTLocation[]>} 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<LocationHistory>} Location history
*/
export const getLocationHistory = async (devices, start, end) => {
const locationHistory = {};