export type anchorPositionType = "middle" | "left" | "right" | "top" | "bottom" | customAnchorType;
export type customAnchorType = { rightness?: number; bottomness?: number };
const getAnchorOffset = (width:number, height:number): { [key in anchorPositionType]: customAnchorType } => // here 'anchorPositionType' getting the error Type 'customAnchorType' is not assignable to type 'symbol' and i don't understand why?
{
return {
middle: { rightness: width * 0.5, bottomness: height * 0.5 },
left: { rightness: 0, bottomness: height * 0.5 },
right: { rightness: width, bottomness: height * 0.5 },
top: { rightness: width * 0.5, bottomness: 0 },
bottom: { rightness: width, bottomness: height * 0.5 }
};
};
我不知道是什么问题。为什么函数签名处的anchorPositionType
出现错误Type 'customAnchorType' is not assignable to type 'symbol'
?