Using WebStorm , the following JSDoc documentation was generated:
/**
* Patient retrieval success action
* @param {Object} patient - Patient object returned from getPatient search query
* @returns {{type, patient: *}}
*/
export const getPatientSuccess = patient => ({
type: PATIENT_LOADED,
patient,
});
In this context, patient
is an object that may contain variable information. Here is another section with a similar JSDoc generated comment:
/**
* Functional stateless component to display medication data
* @param medications
* @returns {*}
* @constructor
*/
const Medications = ({ medications }) => {
if (medications.status === 'success') {
// Return table of medications if available
return (/** Table of medications */);
}
// Return NoDataView by default if no meds are available
return (
<NoDataView
heading="Data Unavailable"
subtext="Medications data unavailable"
isGlyphHidden={false}
/>
);
};
In this context, variable component information may be returned. Is that simply what @returns {*}
means?
In JSDocs, type info is generally wrapped in curly brackets for @returns
and @param
attributes.
@return {*}
specifies that the function returns the type *
.
*
is a wildcard that stands for any type .
In other words, the function can return any type .
Check out the JSDocs docs for more info.
It means
{*} Whatever you want
In the documantation you can see and here is a doc of the returns returns
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.