linaria 类型系统报错



  • 官方案例不能通过

    import React from 'react'
    import { View } from '@tarojs/components'
    import { styled } from 'linaria/react'
    
    const Title = styled(View)<{ color: string }>`
      color: ${
        /* 错误报红 */
        props => props.color}
    `;
    
    const Index: React.FC = () => {
      return <Title color='red'>
        Hello World!
      </Title>
    }
    
    export default Index
    

    Argument of type '(props: any) => any' is not assignable to parameter of type 'StaticPlaceholder'.
    Property '__linaria' is missing in type '(props: any) => any' but required in type 'StyledMeta'.ts(2345)
    StyledMeta.d.ts(2, 5): '__linaria' is declared here.


登录后回复