diff --git a/packages/jss-plugin-compose/src/index.d.ts b/packages/jss-plugin-compose/src/index.d.ts index 73ed869a3..dbfb3e78a 100644 --- a/packages/jss-plugin-compose/src/index.d.ts +++ b/packages/jss-plugin-compose/src/index.d.ts @@ -1,3 +1,7 @@ import {Plugin} from 'jss' +export type ComposeProperties = { + composes: (string | string[])[] +} + export default function jssPluginSyntaxCompose(): Plugin diff --git a/packages/jss-plugin-extend/src/index.d.ts b/packages/jss-plugin-extend/src/index.d.ts index 824e228ad..5884973e8 100644 --- a/packages/jss-plugin-extend/src/index.d.ts +++ b/packages/jss-plugin-extend/src/index.d.ts @@ -1,3 +1,7 @@ -import {Plugin} from 'jss' +import {JssStyle, Plugin} from 'jss' + +export type ExtendProperties = { + extends: (JssStyle | string)[] | JssStyle | string +} export default function jssPluginSyntaxExtend(): Plugin diff --git a/packages/jss-preset-default/src/index.d.ts b/packages/jss-preset-default/src/index.d.ts index c66064dc7..0f0c10ba0 100644 --- a/packages/jss-preset-default/src/index.d.ts +++ b/packages/jss-preset-default/src/index.d.ts @@ -1,7 +1,11 @@ import {Plugin, JssOptions} from 'jss' import {Options as DefaultUnitOptions} from 'jss-plugin-default-unit' import {Options as ObservableOptions} from 'jss-plugin-rule-value-observable' +import {ComposeProperties} from 'jss-plugin-compose' +import {ExtendProperties} from 'jss-plugin-extend' type Options = {defaultUnit?: DefaultUnitOptions; observable?: ObservableOptions} +export type AdditionalProperties = ComposeProperties & ExtendProperties + export default function jssPresetDefault(options?: Options): JssOptions diff --git a/packages/jss/src/index.d.ts b/packages/jss/src/index.d.ts index 806a99d76..a075f1524 100644 --- a/packages/jss/src/index.d.ts +++ b/packages/jss/src/index.d.ts @@ -12,33 +12,38 @@ type Func = T extends undefined ? ((data: P) => R) : ((data: P & {theme type NormalCssProperties = CSSProperties type NormalCssValues = K extends keyof NormalCssProperties ? NormalCssProperties[K] : JssValue -export type JssStyle = +export type JssStyle = {}, Props = any, Theme = undefined> = + // ADDITIONAL_PROPERTIES + | A | { [K in keyof NormalCssProperties]: | NormalCssValues - | JssStyle - | Func | JssStyle | undefined> - | Observable | JssStyle | undefined> + | JssStyle + | Func | JssStyle | undefined> + | Observable | JssStyle | undefined> } | { [K: string]: | JssValue - | JssStyle - | Func | undefined> - | Observable + | JssStyle + | Func | undefined> + | Observable | undefined> } export type Styles< Name extends string | number | symbol = string, + // ADDITIONAL_PROPERTIES + A extends Record = {}, Props = unknown, Theme = undefined > = Record< Name, - | JssStyle + | JssStyle | string - | Func | string | null | undefined> - | Observable + | Func | string | null | undefined> + | Observable | string | null | undefined> > + export type Classes = Record export type Keyframes = Record @@ -252,9 +257,9 @@ export interface JssOptions { id: CreateGenerateIdOptions } -export interface Jss { +export interface Jss = {}> { createStyleSheet( - styles: Partial>, + styles: Partial>, options?: StyleSheetFactoryOptions ): StyleSheet removeStyleSheet(sheet: StyleSheet): this diff --git a/packages/react-jss/src/index.d.ts b/packages/react-jss/src/index.d.ts index 00842fc88..56d0e5ee2 100644 --- a/packages/react-jss/src/index.d.ts +++ b/packages/react-jss/src/index.d.ts @@ -10,6 +10,7 @@ import { Classes } from 'jss' import {createTheming, useTheme, withTheme, ThemeProvider, Theming} from 'theming' +import {AdditionalProperties} from 'jss-preset-default' declare const jss: Jss @@ -77,7 +78,9 @@ interface CreateUseStylesOptions extends BaseOptions( - styles: Styles | ((theme: Theme) => Styles), + styles: + | Styles + | ((theme: Theme) => Styles), options?: CreateUseStylesOptions ): (data?: Props & {theme?: Theme}) => Classes