Skip to content

Instantly share code, notes, and snippets.

@treyhakanson
Created August 18, 2019 20:28
Show Gist options
  • Save treyhakanson/2fd8c792e4811c00b995a39e4141faac to your computer and use it in GitHub Desktop.
Save treyhakanson/2fd8c792e4811c00b995a39e4141faac to your computer and use it in GitHub Desktop.
styled-components/primitives
import * as ReactNative from "react-native";
import * as React from "react";
export {
css,
DefaultTheme,
isStyledComponent,
ThemeConsumer,
ThemeContext,
ThemeProps,
ThemeProvider,
withTheme
} from "./index";
import {
AnyStyledComponent,
DefaultTheme,
isStyledComponent,
StyledComponentInnerAttrs,
StyledComponentInnerComponent,
StyledComponentInnerOtherProps,
ThemedCssFunction,
ThemedStyledFunction,
ThemedStyledInterface,
ThemeProviderComponent,
WithThemeFnInterface,
ThemedBaseStyledInterface,
StyledInterface
} from "./index";
import {
ReactNativeStyledInterface,
ReactNativeThemedBaseStyledInterface
} from "./native";
type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
export type PrimitiveThemedStyledFunction<
C extends React.ComponentType<any>,
T extends object
> = ThemedStyledFunction<C, T>;
type PrimitiveThemedBaseStyledInterface<
T extends object
> = ReactNativeThemedBaseStyledInterface<T>;
type PrimitiveThemedStyledInterface<
T extends object
> = PrimitiveThemedBaseStyledInterface<AnyIfEmpty<T>>;
export type PrimitiveStyledInterface<
T extends object
> = ReactNativeStyledInterface<T>;
export interface PrimitiveThemedStyledComponentsModule<
T extends object,
U extends object = T
> {
default: PrimitiveStyledInterface<T>;
css: ThemedCssFunction<T>;
withTheme: WithThemeFnInterface<T>;
ThemeProvider: ThemeProviderComponent<T, U>;
ThemeConsumer: React.Consumer<T>;
ThemeContext: React.Context<T>;
isStyledComponent: typeof isStyledComponent;
}
declare const styled: PrimitiveStyledInterface<DefaultTheme>;
export default styled;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment