typerscript
Version:
hyperscript and hyperscript helpers written in TypeScript, leveraging TypeStyle
38 lines (37 loc) • 2.22 kB
TypeScript
/// <reference types="react" />
import * as React from 'react';
import * as typestyle from 'typestyle';
export declare class Style<T extends object = any> {
selector: string;
rules: T;
constructor({selector, rules}: {
selector: string;
rules: T;
});
}
export declare type IClass = {
[key: string]: object;
};
export declare type IClasses<T extends IClass> = {
[K in keyof T]: Style<T[K]>;
};
export declare function createClasses<T extends IClass>(classes: T): IClasses<T>;
export declare function _hh<T, Props>(first: string | Style, second: Props, third?: any[]): any;
export declare function _hh<T, Props>(first: string | Style, second?: Props | any[]): any;
export declare function _hh<T, Props>(first: Props, second?: any[]): any;
export declare function _hh<T, Props>(first?: string | Style | Props | any[]): any;
export declare type ComponentType<P> = (React.ReactElement<P>);
export declare type ReactHTMLElement = any;
export declare type ReactElement = any;
import { Attributes, ClassicComponent, Component, ComponentClass, ComponentState, ClassicComponentClass, ClassType, DOMAttributes, HTMLAttributes, ReactHTML, SFC, StatelessComponent } from 'react';
export declare type options<P> = (ComponentClass<P> | string);
export declare type NameOrType<P, T> = ('input' | ReactHTML | string | Function | StatelessComponent<P> | SFC<P> | ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>> | options<P>);
export declare type BaseProps<T> = (T extends ReactHTMLElement ? HTMLAttributes<T> : T extends Element ? DOMAttributes<T> : {});
export declare type AttrProps<P> = Attributes & P;
export declare type ComponentWState<P> = (Component<P, ComponentState>);
export declare function hh<P, T extends NameOrType<P, T>>(nameOrType: T): typeof _hh;
declare function h<T, Props>(nameOrType: any, first: string | Style, second: Props, third?: any[]): any;
declare function h<T, Props>(nameOrType: any, first: string | Style, second?: Props | any[]): any;
declare function h<T, Props>(nameOrType: any, first: Props, second?: any[]): any;
declare function h<T, Props>(nameOrType: any, first?: string | Style | Props | any[]): any;
export { h, typestyle };