facepaint icon indicating copy to clipboard operation
facepaint copied to clipboard

CSS Property Filter Throws Type Error

Open saratozawa opened this issue 5 years ago • 0 comments

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

saratozawa avatar Feb 11 '20 05:02 saratozawa