Having just created the method getSpecificPlacementOption
, I am faced with defining its return value in Typescript. As a newcomer to this language, I find myself unsure of how to go about it. Within my object called placementOptions
, I aim to return a specific value from one of its keys:
export interface PlacementOptions {
badgeOptions?: BadgeOptions;
cardLayoutOptions?: CardLayoutOptions;
}
const getSpecificPlacementOption = (key: placementOptionsKey) => placementOptions[key];
What would be the correct way for me to define the return statement within the method placementOptions[key]
?