Skip to content

Commit 0424a48

Browse files
committed
fix: type issues
1 parent ea2bf18 commit 0424a48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+264
-310
lines changed

package-lock.json

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

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
"packages/*"
4141
],
4242
"devDependencies": {
43-
"@commitlint/cli": "^19.5.0",
44-
"@commitlint/config-conventional": "^19.5.0",
43+
"@commitlint/cli": "^19.6.0",
44+
"@commitlint/config-conventional": "^19.6.0",
4545
"husky": "^9.1.7",
4646
"lerna": "^8.1.9",
4747
"lint-staged": "^15.2.10",
4848
"prettier": "^3.3.3",
4949
"prettier-plugin-svelte": "^3.2.8",
5050
"sass": "^1.81.0",
51-
"svelte": "^5.2.3"
51+
"svelte": "^5.2.4"
5252
}
5353
}

packages/accordion/src/Panel.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
extend?: boolean;
4949
extendedElevation?: number;
5050
};
51-
type $$Props = OwnProps & Omit<ComponentProps<Paper>, keyof OwnProps>;
51+
type $$Props = OwnProps & Omit<ComponentProps<typeof Paper>, keyof OwnProps>;
5252
5353
// Remember to update $$Props if you add/remove/rename props.
5454
export let use: ActionArray = [];

packages/autocomplete/src/Autocomplete.svelte

+11-5
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,21 @@
134134
search?: (input: string) => Promise<any[] | false>;
135135
menu$class?: string;
136136
menu$anchor?: boolean;
137-
menu$anchorCorner?: ComponentProps<Menu>['anchorCorner'];
137+
menu$anchorCorner?: ComponentProps<typeof Menu>['anchorCorner'];
138138
};
139139
type $$Props = OwnProps &
140140
SmuiAttrs<'div', keyof OwnProps> & {
141-
[k in keyof ComponentProps<Menu> as `menu\$${k}`]?: ComponentProps<Menu>[k];
141+
[k in keyof ComponentProps<typeof Menu> as `menu\$${k}`]?: ComponentProps<
142+
typeof Menu
143+
>[k];
142144
} & {
143-
[k in keyof ComponentProps<Textfield> as `textfield\$${k}`]?: ComponentProps<Textfield>[k];
145+
[k in keyof ComponentProps<
146+
typeof Textfield
147+
> as `textfield\$${k}`]?: ComponentProps<typeof Textfield>[k];
144148
} & {
145-
[k in keyof ComponentProps<List> as `list\$${k}`]?: ComponentProps<List>[k];
149+
[k in keyof ComponentProps<typeof List> as `list\$${k}`]?: ComponentProps<
150+
typeof List
151+
>[k];
146152
} & {
147153
textfield$label?: never;
148154
textfield$value?: never;
@@ -194,7 +200,7 @@
194200
};
195201
export let menu$class = '';
196202
export let menu$anchor = false;
197-
export let menu$anchorCorner: ComponentProps<Menu>['anchorCorner'] =
203+
export let menu$anchorCorner: ComponentProps<typeof Menu>['anchorCorner'] =
198204
'BOTTOM_START';
199205
200206
let element: HTMLDivElement;

packages/bottom-app-bar/src/AutoAdjust.svelte

+5-13
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
</svelte:component>
2020

2121
<script lang="ts" generics="TagName extends SmuiEveryElement = 'main'">
22-
import type { SvelteComponent } from 'svelte';
2322
import type { ActionArray } from '@smui/common/internal';
2423
import { classMap } from '@smui/common/internal';
2524
import type {
25+
SmuiComponent,
2626
SmuiElementMap,
2727
SmuiEveryElement,
2828
SmuiAttrs,
@@ -34,11 +34,7 @@
3434
class?: string;
3535
style?: string;
3636
bottomAppBar: BottomAppBar;
37-
component?: typeof SvelteComponent<
38-
Record<string, any>,
39-
Record<string, any>,
40-
Record<string, any>
41-
>;
37+
component?: SmuiComponent<SmuiElementMap[TagName]>;
4238
tag?: TagName;
4339
};
4440
type $$Props = OwnProps & SmuiAttrs<TagName, keyof OwnProps>;
@@ -52,13 +48,9 @@
5248
export let style = '';
5349
export let bottomAppBar: BottomAppBar;
5450
55-
let element: SvelteComponent;
51+
let element: ReturnType<SmuiComponent<SmuiElementMap[TagName]>>;
5652
57-
export let component: typeof SvelteComponent<
58-
Record<string, any>,
59-
Record<string, any>,
60-
Record<string, any>
61-
> = SmuiElement;
53+
export let component: SmuiComponent<SmuiElementMap[TagName]> = SmuiElement;
6254
export let tag: SmuiEveryElement | undefined =
6355
component === SmuiElement ? 'main' : undefined;
6456
@@ -90,7 +82,7 @@
9082
}
9183
}
9284
93-
export function getElement(): SmuiElementMap[TagName] {
85+
export function getElement() {
9486
return element.getElement();
9587
}
9688
</script>

packages/bottom-app-bar/src/Section.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class?: string;
2727
fabInset?: boolean;
2828
};
29-
type $$Props = Omit<ComponentProps<Paper>, keyof OwnProps> &
29+
type $$Props = Omit<ComponentProps<typeof Paper>, keyof OwnProps> &
3030
OwnProps & {
3131
color?: never;
3232
variant?: never;

packages/button/src/Button.svelte

+5-13
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@
6161
lang="ts"
6262
generics="Href extends string | undefined = undefined, TagName extends SmuiEveryElement = Href extends string ? 'a' : 'button'"
6363
>
64-
import type { SvelteComponent } from 'svelte';
6564
import { setContext, getContext } from 'svelte';
6665
import type { ActionArray } from '@smui/common/internal';
6766
import { classMap, dispatch } from '@smui/common/internal';
6867
import Ripple from '@smui/ripple';
6968
import type {
69+
SmuiComponent,
7070
SmuiElementMap,
7171
SmuiEveryElement,
7272
SmuiAttrs,
@@ -85,11 +85,7 @@
8585
action?: string;
8686
defaultAction?: boolean;
8787
secondary?: boolean;
88-
component?: typeof SvelteComponent<
89-
Record<string, any>,
90-
Record<string, any>,
91-
Record<string, any>
92-
>;
88+
component?: SmuiComponent<SmuiElementMap[TagName]>;
9389
tag?: TagName;
9490
};
9591
type $$Props = OwnProps & SmuiAttrs<TagName, keyof OwnProps>;
@@ -108,16 +104,12 @@
108104
export let defaultAction = false;
109105
export let secondary = false;
110106
111-
let element: SvelteComponent;
107+
let element: ReturnType<SmuiComponent<SmuiElementMap[TagName]>>;
112108
let internalClasses: { [k: string]: boolean } = {};
113109
let internalStyles: { [k: string]: string } = {};
114110
let context = getContext<string | undefined>('SMUI:button:context');
115111
116-
export let component: typeof SvelteComponent<
117-
Record<string, any>,
118-
Record<string, any>,
119-
Record<string, any>
120-
> = SmuiElement;
112+
export let component: SmuiComponent<SmuiElementMap[TagName]> = SmuiElement;
121113
export let tag: SmuiEveryElement | undefined =
122114
component === SmuiElement ? (href == null ? 'button' : 'a') : undefined;
123115
@@ -180,7 +172,7 @@
180172
}
181173
}
182174
183-
export function getElement(): SmuiElementMap[TagName] {
175+
export function getElement() {
184176
return element.getElement();
185177
}
186178
</script>

packages/checkbox/src/Checkbox.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
let nativeChecked: boolean | undefined = isUninitializedValue(group)
150150
? isUninitializedValue(checked)
151151
? false
152-
: checked ?? undefined
152+
: (checked ?? undefined)
153153
: group.indexOf(value) !== -1;
154154
let context = getContext<string | undefined>('SMUI:checkbox:context');
155155
let dataTableHeader = getContext<boolean | undefined>(

0 commit comments

Comments
 (0)