如何用打字稿和打字稿解决情感问题

时间:2021-03-22 14:58:02

标签: reactjs typescript emotion

我正在尝试创建带有情感的标记,但它不起作用,我相信是因为打字稿,因为它在 javascript 文件中有效。有大佬知道怎么解决吗?

我的主题:

import '@emotion/react';

export const palette = {
  common: {
    black: '000',
    white: 'fff'
  }

我的组件:

    import styled from '@emotion/styled';
    
    import { theme } from '../../utils/theme';    
         

      export const button = styled.button`
           background: ${({ theme }) => theme.pallete.common.black};
        `;

错误:

Property 'pallete' does not exist on type 'object'

1 个答案:

答案 0 :(得分:1)

你好像打错了

Property 'pallete' does not exist on type 'object'

名称为 palette

尝试修改名称