Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit ba5c2d5

Browse files
committed
Fix strict errors
1 parent f7b2fdf commit ba5c2d5

25 files changed

+188
-65
lines changed

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"trailingComma": "es5",
3+
"semi": false
4+
}

dist/tw-button.vue.d.ts

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
declare const _default: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
2+
[x: string]: unknown;
3+
}>>, unknown, {
4+
disabled: boolean;
5+
tooltipInstance: null;
6+
hoverCount: number;
7+
}, {
8+
slotted(): any;
9+
classnames(): any;
10+
}, {
11+
doAction(ev: any): Promise<void>;
12+
doClick(ev: any): Promise<void>;
13+
doBeforeClick(ev: any): Promise<void>;
14+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "action" | "update:active")[], "click" | "action" | "update:active", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<({
15+
[x: number]: string;
16+
} & {
17+
length?: number | undefined;
18+
toString?: string | undefined;
19+
toLocaleString?: string | undefined;
20+
concat?: string[] | undefined;
21+
join?: string | undefined;
22+
slice?: string[] | undefined;
23+
indexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
24+
lastIndexOf?: ((searchElement: string, fromIndex?: number | undefined) => number) | undefined;
25+
every?: {
26+
<S extends string>(predicate: (value: string, index: number, array: readonly string[]) => value is S, thisArg?: any): this is readonly S[];
27+
(predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any): boolean;
28+
} | undefined;
29+
some?: ((predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any) => boolean) | undefined;
30+
forEach?: ((callbackfn: (value: string, index: number, array: readonly string[]) => void, thisArg?: any) => void) | undefined;
31+
map?: (<U>(callbackfn: (value: string, index: number, array: readonly string[]) => U, thisArg?: any) => U[]) | undefined;
32+
filter?: {
33+
<S_1 extends string>(predicate: (value: string, index: number, array: readonly string[]) => value is S_1, thisArg?: any): S_1[];
34+
(predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any): string[];
35+
} | undefined;
36+
reduce?: {
37+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string): string;
38+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string, initialValue: string): string;
39+
<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: readonly string[]) => U_1, initialValue: U_1): U_1;
40+
} | undefined;
41+
reduceRight?: {
42+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string): string;
43+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string, initialValue: string): string;
44+
<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: readonly string[]) => U_2, initialValue: U_2): U_2;
45+
} | undefined;
46+
find?: {
47+
<S_2 extends string>(predicate: (this: void, value: string, index: number, obj: readonly string[]) => value is S_2, thisArg?: any): S_2 | undefined;
48+
(predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any): string | undefined;
49+
} | undefined;
50+
findIndex?: ((predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any) => number) | undefined;
51+
entries?: IterableIterator<[number, string]> | undefined;
52+
keys?: IterableIterator<number> | undefined;
53+
values?: IterableIterator<string> | undefined;
54+
includes?: ((searchElement: string, fromIndex?: number | undefined) => boolean) | undefined;
55+
flatMap?: (<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined) => U_3[]) | undefined;
56+
flat?: unknown[] | undefined;
57+
}) | ({} & {
58+
[x: string]: any;
59+
})>, {
60+
[x: number]: string;
61+
} | {}>;
62+
export default _default;

dist/tw-dropdown.vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare const _default: {
88
default: string;
99
};
1010
};
11-
setup(props: any): {
11+
setup(): {
1212
target: import("vue").Ref<any>;
1313
active: import("vue").Ref<boolean>;
1414
};

dist/tw-label.vue.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
declare const _default: {
2+
props: {
3+
label: {
4+
type: StringConstructor;
5+
default: null;
6+
};
7+
};
8+
data(): {
9+
id: string;
10+
};
11+
};
12+
export default _default;

dist/tw-list.vue.d.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
declare const _default: import("vue").DefineComponent<{
2+
distance: {
3+
type: NumberConstructor;
4+
default: number;
5+
};
6+
scrollable: {
7+
type: BooleanConstructor;
8+
default: boolean;
9+
};
10+
}, unknown, {
11+
count: number;
12+
loading: boolean;
13+
}, {}, {
14+
doMore(): void;
15+
onScroll(ev: any): void;
16+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
17+
distance: number;
18+
scrollable: boolean;
19+
} & {}>, {
20+
distance: number;
21+
scrollable: boolean;
22+
}>;
23+
export default _default;

dist/tw-menu.vue.d.ts

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
declare const _default: {
2-
props: {
3-
items: {
4-
type: ArrayConstructor;
5-
};
6-
target: {
7-
type: {
8-
new (): Element;
9-
prototype: Element;
10-
};
11-
};
1+
declare const _default: import("vue").DefineComponent<{
2+
items: {
3+
type: ArrayConstructor;
4+
default: () => never[];
125
};
13-
data(): {
14-
blocked: boolean;
15-
};
16-
methods: {
17-
doAction(item: any): Promise<void>;
6+
target: {
7+
type: {
8+
new (): Element;
9+
prototype: Element;
10+
};
1811
};
19-
};
12+
}, unknown, {
13+
blocked: boolean;
14+
}, {}, {
15+
doAction(item: any): Promise<void>;
16+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
17+
items: unknown[];
18+
} & {
19+
target?: Element | undefined;
20+
}>, {
21+
items: unknown[];
22+
}>;
2023
export default _default;

dist/tw-object.vue.d.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
declare const _default: import("vue").DefineComponent<{
2+
value: {
3+
type: ObjectConstructor;
4+
default: null;
5+
};
6+
}, unknown, unknown, {
7+
obj(): any;
8+
entries(): [string, any][];
9+
isArray(): boolean;
10+
isObject(): boolean;
11+
isNull(): any;
12+
isTrue(): any;
13+
isFalse(): any;
14+
isDate(): boolean;
15+
isNumber(): any;
16+
isString(): any;
17+
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
18+
value: Record<string, any>;
19+
} & {}>, {
20+
value: Record<string, any>;
21+
}>;
22+
export default _default;

dist/tw-popover.vue.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{
88
default: boolean;
99
};
1010
target: {
11+
type: (BooleanConstructor | ObjectConstructor)[];
1112
default: boolean;
1213
};
1314
transition: {

dist/tw-tooltip-trigger.vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ declare const _default: import("vue").DefineComponent<{
44
};
55
}, {
66
placement: import("vue").Ref<string>;
7-
target: import("vue").Ref<any>;
7+
target: import("vue").Ref<null>;
88
text: import("vue").Ref<string>;
99
active: import("vue").Ref<boolean>;
1010
} | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{

dist/twindy-headless.es.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface TwindyNotification {
1010
export interface TwindyMenuItem {
1111
id: string | number;
1212
title?: string;
13+
value?: string;
1314
checked?: boolean;
1415
blocked?: boolean;
1516
action?: (item: any) => void;

prettier.config.js

-4
This file was deleted.

src/tw-button.vue

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@
2525
</button>
2626
</template>
2727

28-
<script>
28+
<script lang="ts">
2929
import TwSymbol from "./tw-symbol.vue"
3030
import { defineComponent } from "vue"
3131

32-
// @action, @click
33-
3432
export default defineComponent({
3533
components: {
3634
TwSymbol,
@@ -55,7 +53,7 @@ export default defineComponent({
5553
role: {
5654
type: String,
5755
default: "button",
58-
validator(value) {
56+
validator(value: string) {
5957
return ["button", "link"].includes(value)
6058
},
6159
},

src/tw-dropdown.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export default {
3535
// }
3636
// },
3737

38-
setup(props: any) {
38+
setup() {
3939
let active = ref<boolean>(false)
40-
let target = ref<Node>()
40+
let target = ref<HTMLElement>()
4141

4242
return {
4343
target,

src/tw-items.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@mousedown="doAction(item)"
1111
@keydown.enter="doAction(item)"
1212
class="tw-items-item"
13-
:class="{ '-selected': selected === index || selected === item._id }"
13+
:class="{ '-selected': selected === index || selected === item.id }"
1414
>
1515
<slot :item="item" :index="index"> {{ index }}. {{ item }} </slot>
1616
</div>
@@ -19,12 +19,13 @@
1919
</template>
2020

2121
<script lang="ts">
22-
import { defineComponent } from "vue"
22+
import { defineComponent, PropType } from "vue"
23+
import { TwindyMenuItem } from "./types"
2324

2425
export default defineComponent({
2526
props: {
2627
items: {
27-
type: Array,
28+
type: Array as PropType<TwindyMenuItem[]>,
2829
default: () => [],
2930
},
3031
selected: {

src/tw-label.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
</template>
1313

14-
<script>
14+
<script lang="ts">
1515
import { UUID } from "./lib/uuid"
1616

1717
export default {

src/tw-link.vue

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { defineComponent } from "vue"
1111
import TwButton from "./tw-button.vue"
1212

1313
export default defineComponent({
14-
name: "tw-link",
1514
components: { TwButton },
1615
})
1716
</script>

src/tw-list.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
</div>
1111
</template>
1212

13-
<script>
13+
<script lang="ts">
1414
import { defineComponent } from "vue"
15+
1516
export default defineComponent({
16-
name: "tw-list",
1717
props: {
1818
distance: {
1919
type: Number,
@@ -40,14 +40,14 @@ export default defineComponent({
4040
end: this.distance,
4141
})
4242
},
43-
onScroll(ev) {
43+
onScroll(ev: any) {
4444
const scrollY = ev.target.scrollTop
4545
const visible = ev.target.clientHeight
4646
const bufferHeight = /* this.getFillHeight */ +visible * 0.75 // px before scroll end
4747
const pageHeight = ev.target.scrollHeight - bufferHeight
4848
const bottomOfPage = visible + scrollY >= pageHeight
4949
if (bottomOfPage) {
50-
this.doMore(false)
50+
this.doMore()
5151
}
5252
},
5353
},

src/tw-menu.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
</template>
2020

2121
<script lang="ts">
22+
import { PropType, defineComponent } from "vue"
2223
import { TwindyMenuItem } from "./types"
2324

24-
export default {
25+
export default defineComponent({
2526
props: {
2627
items: {
27-
type: Array,
28+
type: Array as PropType<TwindyMenuItem[]>,
29+
default: () => [],
2830
},
2931
target: {
3032
type: Element,
@@ -42,5 +44,5 @@ export default {
4244
}
4345
},
4446
},
45-
}
47+
})
4648
</script>

src/tw-notification.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { defineComponent } from "vue"
1414
import { notifications } from "./state"
1515
1616
export default defineComponent({
17-
setup(props) {
17+
setup() {
1818
return {
1919
notifications,
2020
}

0 commit comments

Comments
 (0)