Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Property Filter Throws Type Error #22

Open
saratozawa opened this issue Feb 11, 2020 · 0 comments
Open

CSS Property Filter Throws Type Error #22

saratozawa opened this issue Feb 11, 2020 · 0 comments

Comments

@saratozawa
Copy link

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 saratozawa changed the title CSS Attribute Filter Throws Type Error CSS Property Filter Throws Type Error Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant