Skip to content

CSS Property Filter Throws Type Error #22

Description

@saratozawa

Type of issue:
potential bug in type definition file

Current behavior:
image

Expected behavior:
No type errors

Solution that I've found:
In the type definition file, if you change the args type (Arg[] to Arg), the type error is fixed.

Current Type Definition file:

interface DynamicStyleFunction {
        (...args: Arg[]): DynamicStyle[];
    }

After my fix:

interface DynamicStyleFunction {
        (...args: Arg): DynamicStyle[];
    }

To reproduce:

const mq = facepaint([
  '@media(max-width: 767px)',
  '@media(min-width: 768px)',
])

const Background = styled.div<{ src: string }>`
${({ src }) =>
  mq({
    background: [null, null, `url(${src}) no-repeat`],
    backgroundSize: [null, null, '100% 100%'],
    filter: [null, null, 'blur(10px)'],
  })
}`

Environment information:
react v16.12.0
@emotion/core v10.0.27
@emotion/styled v10.0.27
facepaint v1.2.1
@types/facepaint v1.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions