Skip to content

Commit

Permalink
Check 'string extends Composers[K]' too
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoz committed Mar 12, 2022
1 parent 723ced7 commit 9fef4d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions packages/core/types/stitches.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default interface Stitches<
)
}
theme:
string
string
& {
className: string
selector: string
Expand Down Expand Up @@ -143,7 +143,9 @@ export default interface Stitches<
...composers: {
[K in keyof Composers]: (
// Strings and Functions can be skipped over
Composers[K] extends string | Util.Function
string extends Composers[K]
? Composers[K]
: Composers[K] extends string | Util.Function
? Composers[K]
: RemoveIndex<CSS> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
Expand Down
12 changes: 8 additions & 4 deletions packages/react/types/stitches.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default interface Stitches<
)
}
theme:
string
string
& {
className: string
selector: string
Expand Down Expand Up @@ -145,7 +145,9 @@ export default interface Stitches<
...composers: {
[K in keyof Composers]: (
// Strings, React Components, and Functions can be skipped over
Composers[K] extends string | React.ExoticComponent<any> | React.JSXElementConstructor<any> | Util.Function
string extends Composers[K]
? Composers[K]
: Composers[K] extends string | React.ExoticComponent<any> | React.JSXElementConstructor<any> | Util.Function
? Composers[K]
: RemoveIndex<CSS> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
Expand Down Expand Up @@ -208,14 +210,16 @@ export default interface Stitches<
| React.ComponentType<any>
| Util.Function
| { [name: string]: unknown }
)[],
)[],
CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils>
>(
type: Type,
...composers: {
[K in keyof Composers]: (
// Strings, React Components, and Functions can be skipped over
Composers[K] extends string | React.ComponentType<any> | Util.Function
string extends Composers[K]
? Composers[K]
: Composers[K] extends string | React.ComponentType<any> | Util.Function
? Composers[K]
: RemoveIndex<CSS> & {
/** The **variants** property lets you set a subclass of styles based on a key-value pair.
Expand Down

0 comments on commit 9fef4d1

Please sign in to comment.