Skip to content

Commit 6c67cfa

Browse files
authored
Merge pull request #3 from alexkharech/master
added types for theme configuration
2 parents 55e3eb9 + 6e34f40 commit 6c67cfa

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

index.d.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,28 @@ type CSS = CSSProperties
1313

1414
type Component = Vue.Component | Vue.DefineComponent
1515

16+
type ThemeObject = { theme: { type: any; required: true } }
17+
1618
type StyledHTMLElement = {
1719
[K in keyof IntrinsicElementAttributes]: (
18-
str: TemplateStringsArray
20+
str: TemplateStringsArray,
21+
...placeholders: ((
22+
props: Vue.ExtractPropTypes<ThemeObject>
23+
) => string | { toString: () => string })[]
1924
) => Vue.DefineComponent<IntrinsicElementAttributes[K]>
2025
}
2126

2227
type StyledFunctionHTMLElement = {
2328
<
2429
Props = { [key: string]: Vue.Prop<unknown> },
25-
K extends keyof IntrinsicElementAttributes
30+
K extends keyof IntrinsicElementAttributes = any
2631
>(
2732
component: K,
2833
props?: Props
2934
): (
3035
str: TemplateStringsArray,
3136
...placeholders: ((
32-
props: Vue.ExtractPropTypes<Props>
37+
props: Vue.ExtractPropTypes<Props & ThemeObject>
3338
) => string | { toString: () => string })[]
3439
) => Vue.DefineComponent<
3540
Vue.ExtractPropTypes<Props> & IntrinsicElementAttributes[K]
@@ -38,7 +43,10 @@ type StyledFunctionHTMLElement = {
3843

3944
type StyledVueComponent = {
4045
<Props, T extends Component>(component: T): (
41-
str: TemplateStringsArray
46+
str: TemplateStringsArray,
47+
...placeholders: ((
48+
props: Vue.ExtractPropTypes<ThemeObject>
49+
) => string | { toString: () => string })[]
4250
) => Vue.DefineComponent<Props> & T
4351
}
4452

@@ -224,7 +232,7 @@ interface IntrinsicElementAttributes {
224232
view: Vue.SVGAttributes
225233
}
226234

227-
export const ThemeProvider: Vue.DefineComponent<{ theme: object }>
235+
export const ThemeProvider: Vue.DefineComponent<ThemeObject>
228236

229237
export const css: (input: TemplateStringsArray) => string
230238

0 commit comments

Comments
 (0)