svelte-material-ui
svelte-material-ui copied to clipboard
Type error in tab-bar version 6.0.0
Running svelte-check on a project that uses tab-bar gives now type errors since SMUI version 6.0.0.
xxx\node_modules\@smui\tab-bar\src\TabBar.types.ts:4:49
Error: Generic type 'TabBar__SvelteComponent_<TabKey>' requires 1 type argument(s).
export declare class TabBarComponentDev extends Component {
/**
xxx\node_modules\@smui\tab-bar\src\TabBar.types.ts:23:7
Error: Generic type 'TabBar__SvelteComponent_<TabKey>' requires 1 type argument(s).
[k in keyof TabScrollerComponentDev['$$prop_def'] as `tabScroller\$${k}`]?: TabScrollerComponentDev['$$prop_def'][k];
} & Component['$$prop_def'];
}
xxx\MyComponent.svelte:42:2
Error: JSX element type 'TabBar' does not have any construct or call signatures. (ts)
This seems to stem from the latest commit to TabBar.types.ts that removed the generic type arguments: https://github.com/hperrin/svelte-material-ui/commit/67f45cc6bd628bd772c8717d20c0699be08e5d0d#diff-8b06dcf1c203cb131e27c62fb0241d13233ca8418ec32d6b181224cd4185135d
If I add back the type arguments in my local copy, the errors go away.
I figured this out. I'll have a fix in v7, where types are getting a big improvement.

how to skip the error lanching svelte-check ?
@regnou: FWIW, you can resolve the svelte-check error by upgrading the @smui/tab-bar
dependency in package.json
to 7.0.0-beta.0
. You can do that even if you'd prefer to leave the rest of the @smui/*
packages on the latest non-beta release (e.g. 6.1.4
).
This is fixed now in v7. :)