鉴于这种
type LocationWeather = {
name: string;
temperature: number;
};
type IndexProp = {
savedLocationsWeather: LocationWeather[];
favoriteLocationWeather: LocationWeather;
};
function Index({ savedLocationsWeather, favoriteLocationWeather }: IndexProp)
Run Code Online (Sandbox Code Playgroud)
文档应该是什么样的?
我的第一个方法是:
/**
* Home page displaying weather details of saved locations and favorite location
* @param {object} props Component props
* @param {LocationWeather[]} props.savedLocationsWeather Weather details of saved locations
* @param {LocationWeather} props.favoriteLocationWeather Weather details of favorite location
* @return {TSX.Element}
*/
Run Code Online (Sandbox Code Playgroud)
但:
我不确定这是否是指定 savingLocationsWeather 的数组类型的正确方法,如
* @param {Array} props.savedLocationsWeather Weather details of saved …
document jsdoc typescript reactjs react-functional-component