-
Notifications
You must be signed in to change notification settings - Fork 0
/
shims-vue.d.ts
63 lines (52 loc) · 1.8 KB
/
shims-vue.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}
declare module "vue-styled-components" {
import * as CSS from "csstype";
import * as Vue from "vue";
import { defineComponent, ExtractPropTypes } from "@vue/composition-api";
type ExcludeArrayString<T> = T extends string[] ? never : T;
type VueProps = ExcludeArrayString<
Parameters<typeof defineComponent>[0]["props"]
>;
export type CSSProperties = CSS.Properties<string | number>;
export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject };
export interface CSSObject extends CSSProperties, CSSPseudos {
[key: string]: CSSObject | string | number | undefined;
}
export type CSS = CSSProperties;
export type StyledComponent<Props extends VueProps> = Vue.Component &
Vue.VueConstructor & {
extend<U extends VueProps>(
cssRules: TemplateStringsArray,
...interpolate: TemplateStringsArray[]
): StyledComponent<Props & U>;
withComponent<V extends VueProps>(
target: Vue.VueConstructor
): StyledComponent<Props & V>;
} & { new (props: ExtractPropTypes<Props>): Vue.Component };
export type StyledComponentElements = {
[k in keyof HTMLElementTagNameMap]: (
str: TemplateStringsArray
) => StyledComponent<{}>;
};
export type Component =
| HTMLElementTagNameMap
| keyof HTMLElementTagNameMap
| Vue.Component
| Vue.VueConstructor;
export type Styled = StyledComponentElements & {
<T extends Component, Props extends VueProps>(
Component: T,
props?: Props
): (
str: TemplateStringsArray,
...placeholders: ((
props: ExtractPropTypes<Props>
) => string | string | { toString: () => string | string })[]
) => StyledComponent<Props>;
};
export let styled: Styled;
export default styled;
}