тип машинописного текста нельзя назначить для ошибки типа «символ» - PullRequest
0 голосов
/ 18 апреля 2020
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'?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...