Skip to content

Commit

Permalink
fix: Use upstream types to pass down theme & props
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Mar 8, 2019
1 parent 588807e commit 4d01702
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
// Type definitions for styled-media-query 2.0.2
// Project: https://github.com/morajabi/styled-media-query
// Definitions by: François Best <https://github.com/franky47>
// TypeScript version: 3.1.6

type GeneratorFunction<Theme> = <P>(
import { ThemedStyledProps, FlattenInterpolation } from 'styled-components'

type GeneratorFunction<Props, Theme> = (
strings: TemplateStringsArray,
...interpolations: (any)[]
...interpolations: (
| ((
props: ThemedStyledProps<Props, Theme>
) => string | FlattenInterpolation<ThemedStyledProps<Props, Theme>>)
| FlattenInterpolation<ThemedStyledProps<Props, Theme>>)[]
) => any

// --

export interface MediaGenerator<Breakpoints, Theme> {
lessThan: (breakpoint: keyof Breakpoints) => GeneratorFunction<Theme>
greaterThan: (breakpoint: keyof Breakpoints) => GeneratorFunction<Theme>
between: (
lessThan: <Props>(
breakpoint: keyof Breakpoints
) => GeneratorFunction<Props, Theme>
greaterThan: <Props>(
breakpoint: keyof Breakpoints
) => GeneratorFunction<Props, Theme>
between: <Props>(
fist: keyof Breakpoints,
second: keyof Breakpoints
) => GeneratorFunction<Theme>
) => GeneratorFunction<Props, Theme>
}

// --
Expand Down

0 comments on commit 4d01702

Please sign in to comment.