How to make a Javascript service that returns a Promise<User>

I am writing a service in javascript and want to write a helper function that looks up a user by username and returns it. what is the proper syntax for this?

Currently I am doing this:

/**
 * @private
 * @param {String} username
 * @returns {Promise&lt;Backendless.User&gt;}
*/
getUser(username) {
var query = ...
return Backendless.Data.of(Backendless.User).findFirst(query)
}

The code you have is correct. I just tried and it works for me.