Skip to content

Commit

Permalink
Export InterpolationValue type and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Igorbek committed Jan 20, 2017
1 parent e19415c commit 9e7016c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions native/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export {
ThemeProps,
ThemeProvider,
Interpolation,
InterpolationValue,
InterpolationFunction,
OuterStyledProps,
StyledFunction,
Expand Down
15 changes: 8 additions & 7 deletions typings/styled-components.d.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import * as React from "react";
import { StatelessComponent, ComponentClass } from "react";

type Component<P> = ComponentClass<P> | StatelessComponent<P>;

export interface ThemeProps {
theme: any;
}

type Component<P> = ComponentClass<P> | StatelessComponent<P>;
export type StyledProps<P> = P & ThemeProps;
export interface InterpolationFunction<P> {
(props: StyledProps<P>): InterpolationValue<P> | ReadonlyArray<Interpolation<P>>;
}
type InterpolationValue<P> = string | number;
export type Interpolation<P> = InterpolationFunction<P> | InterpolationValue<P> | ReadonlyArray<InterpolationValue<P> | InterpolationFunction<P>>;

export type OuterStyledProps<P> = P & {
theme?: Object;
innerRef?: (instance: any) => void;
};

export type Interpolation<P> = InterpolationValue | InterpolationFunction<P> | ReadonlyArray<InterpolationValue | InterpolationFunction<P>>;
export type InterpolationValue = string | number;
export interface InterpolationFunction<P> {
(props: StyledProps<P>): InterpolationValue | ReadonlyArray<Interpolation<P>>;
}

export interface StyledFunction<P> {
(strings: TemplateStringsArray, ...interpolations: Interpolation<StyledProps<P>>[]): ComponentClass<OuterStyledProps<P>>;
<U>(strings: TemplateStringsArray, ...interpolations: Interpolation<StyledProps<P & U>>[]): ComponentClass<OuterStyledProps<P & U>>;
Expand Down

0 comments on commit 9e7016c

Please sign in to comment.