Skip to content

Commit

Permalink
hopfylly nothing was broken in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
hadihallak authored and jonathantneal committed Aug 12, 2021
1 parent d41d610 commit a23e077
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 34 deletions.
7 changes: 4 additions & 3 deletions packages/react/types/css-util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export type CSS<
Media = Default.Media,
Theme = {},
ThemeMap = Default.ThemeMap,
Utils = {}
Utils = {},
isFlat= false
> = (
// nested at-rule css styles
& {
Expand Down Expand Up @@ -97,7 +98,7 @@ export type CSS<
)
}
// unknown css declaration styles
& {
& (false extends isFlat ? {
/** Unknown property. */
[K in string]: (
| number
Expand All @@ -106,7 +107,7 @@ export type CSS<
| {}
| undefined
)
}
}: {})
)

/** Unique symbol used to reference a property value. */
Expand Down
4 changes: 3 additions & 1 deletion packages/react/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type CSSProperties = CSSUtil.CSSProperties
export type DefaultThemeMap = Default.ThemeMap

/** Returns a Style interface from a configuration, leveraging the given media and style map. */

export type CSS<
Config extends {
media?: {}
Expand All @@ -27,7 +28,8 @@ export type CSS<
Config['media'],
Config['theme'],
Config['themeMap'],
Config['utils']
Config['utils'],
false
>

/** Returns the properties, attributes, and children expected by a component. */
Expand Down
35 changes: 5 additions & 30 deletions packages/react/types/stitches.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ export default interface Stitches<
? Composers[K]
: Composers[K] extends Util.Function
? Composers[K]
: Composers[K] extends {
[K2 in keyof Composers[K]]: Composers[K][K2]
}
? (
: CSSUtil.CSS<Media, Theme, ThemeMap, Utils, true> & (
& {
/** The **variants** property sets variants.
*
Expand Down Expand Up @@ -158,17 +155,8 @@ export default interface Stitches<
: Util.WideObject
)
}
& {
[Prelude in keyof Composers[K]]:
Prelude extends keyof CSS | 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: Composers[K][Prelude] extends Record<string, unknown>
? CSS
: boolean | number | string
}
& CSS
)
: never

) & {[K2 in keyof Composers[K]]:K2 extends 'variants' | 'defaultVariants' | 'compoundVariants' ? unknown : K2 extends keyof CSS ? CSS[K2] : unknown}
)
}
): StyledComponent.CssComponent<
Expand Down Expand Up @@ -205,10 +193,7 @@ export default interface Stitches<
? Composers[K]
: Composers[K] extends Util.Function
? Composers[K]
: Composers[K] extends {
[K2 in keyof Composers[K]]: Composers[K][K2]
}
? (
: CSSUtil.CSS<Media, Theme, ThemeMap, Utils, true> & (
& {
/** The **variants** property sets variants.
*
Expand Down Expand Up @@ -240,17 +225,7 @@ export default interface Stitches<
: Util.WideObject
)
}
& {
[Prelude in keyof Composers[K]]:
Prelude extends keyof CSS | 'compoundVariants' | 'defaultVariants' | 'variants'
? unknown
: Composers[K][Prelude] extends Record<string, unknown>
? CSS
: boolean | number | string
}
& CSS
)
: never
) & {[K2 in keyof Composers[K]]:K2 extends 'variants' | 'defaultVariants' | 'compoundVariants' ? unknown : K2 extends keyof CSS ? CSS[K2] : unknown}
)
}
): StyledComponent.StyledComponent<
Expand Down

0 comments on commit a23e077

Please sign in to comment.