Closed sxxov closed 1 year ago
The @overload tag should always preceed @returns, otherwise TypeScript will complain that no return type is defined for that specific overload.
@overload
@returns
Expected Behaviour
/** * Get user from session * * @overload * @returns {Promise<ResultStrict<ApiOk<User>>>} */ /** * Get user from id * * @overload * @param {string} userId * @returns {Promise<ResultStrict<ApiAny<ForeignUser | User>>>} */ /** * @param {string | undefined} userId * @returns {Promise<ResultStrict<ApiAny<ForeignUser | User>>>} */ async getUser(userId = undefined) { // ...
Actual Behaviour
/** * Get user from session * * @returns {Promise<ResultStrict<ApiOk<User>>>} * @overload */ /** * Get user from id * * @param {string} userId * @returns {Promise<ResultStrict<ApiAny<ForeignUser | User>>>} * @overload */ /** * @param {string | undefined} userId * @returns {Promise<ResultStrict<ApiAny<ForeignUser | User>>>} */ async getUser(userId = undefined) { // ...
The
@overload
tag should always preceed@returns
, otherwise TypeScript will complain that no return type is defined for that specific overload.Example
Expected Behaviour
Actual Behaviour
Error