@types/styled-theming
TypeScript icon, indicating that this package has built-in type declarations

2.2.8 • Public • Published

Installation

npm install --save @types/styled-theming

Summary

This package contains type definitions for styled-theming (https://github.com/styled-components/styled-theming#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/styled-theming.

index.d.ts

import { FlattenInterpolation, ThemedStyledProps, ThemeProps } from "styled-components";

declare function theme(name: string, values: theme.ThemeMap): theme.ThemeSet;

declare namespace theme {
    type ThemeValueResult =
        | string
        | FlattenInterpolation<ThemeProps<any>>
        | FlattenInterpolation<ThemedStyledProps<any, any>>;
    type ThemeValueFn = (props: object) => ThemeValueResult;
    type ThemeValue = ThemeValueFn | ThemeValueResult;

    interface ThemeMap {
        [key: string]: ThemeValue;
    }

    type VariantMap<TVariant extends string> = {
        [key in TVariant]: ThemeMap;
    };

    type ThemeSet = (props: object) => string;
    type VariantSet<TProp extends string, TVariant extends string> = (props: { [key in TProp]?: TVariant }) => string;

    function variants<TProp extends string, TVariant extends string>(
        name: string,
        prop: TProp,
        values: VariantMap<TVariant>,
    ): VariantSet<TProp, TVariant>;
}

export = theme;

Additional Details

Credits

These definitions were written by Arjan Jassal, Hieu Ho, and David Daniell.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/styled-theming

Weekly Downloads

10,868

Version

2.2.8

License

MIT

Unpacked Size

5.17 kB

Total Files

5

Last publish

Collaborators

  • types