DefinitelyTyped/types/cxs/index.d.ts
Daniel Eden 33a94d5028
Add type definitions for cxs-css/cxs (#45875)
* Add type definitions for cxs-css/cxs

* Address linter/CI issues

* Fix importing and reintroduce ts-expect-error

* Fix tsconfig

* Fix import path in tests

* Omit ts-expect-error

* Try to fix compile error

* Use ts-expect-error instead of $ExpectError

* Remove directive in component

* Remove error-causing callsites

* Prefer interface over props

* Turn off export to fix lint error
2020-07-06 12:50:46 -07:00

28 lines
861 B
TypeScript

// Type definitions for cxs 6.2
// Project: https://github.com/cxs-css/cxs
// Definitions by: Daniel Eden <https://github.com/daneden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version 3.9
import * as CSS from 'csstype';
declare namespace cxs {
type CSSProperties = CSS.Properties<string | number>;
type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject };
interface CSSObject extends CSSProperties, CSSPseudos {
[key: string]: CSSObject | string | number | undefined;
}
}
declare const cxs: {
(styles: cxs.CSSObject): string;
/** Returns cached CSS as a string for server-side rendering */
css: () => string;
/** Resets the CSS cache for future renders */
reset: () => void;
/** Sets a custom className prefix */
prefix: (val: string) => void;
};
export = cxs;