Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

reactjs - 在REACT中有打字稿错误TS7053(having Typescript error TS7053 within REACT)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...