i'm new to typescript and face an error: Element implicitly has an 'any' type because expression of type '"data-direction"' can't be used to index type 'Pick
(我是TypeScript的新手,并且遇到错误:元素隐式具有'any'类型,因为类型'“ data-direction”'的表达式不能用于索引类型'Pick)
<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>
Here is my code:
(这是我的代码:)
import styled from 'styled-components';
const Cell = styled.div`
display: flex;
justify-content: center;
text-align: center;
align-items: center;
font-size: 40px;
height: 98px;
width: 98px;
border: 1px solid black;
transform: rotate(${props => `${props['data-direction']}deg`});
`;
<Grid data-rows={rows} data-cols={cols}>
{grid.map((row, x) =>
row.map((_, y) => (
<Cell
id={`${x}${y}`}
data-direction={Helpers.rotationMapper[currentDirection]}
>
{Helpers.isCurrentPosition(x, y, currentPosition) && '??'}
</Cell>
))
)}
</Grid>
ask by Ryu translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…