Fix types

This commit is contained in:
Adria Navarro 2024-12-20 11:10:06 +01:00
parent dd29dcedc8
commit e00002757e
1 changed files with 17 additions and 14 deletions

View File

@ -11,7 +11,7 @@ interface BuilderViewV2Store {
interface DerivedViewV2Store extends BuilderViewV2Store {
list: ViewV2[]
selected: ViewV2
selected?: ViewV2
}
export class ViewV2Store extends DerivedBudiStore<
@ -20,7 +20,9 @@ export class ViewV2Store extends DerivedBudiStore<
> {
constructor() {
const makeDerivedStore = (store: Writable<BuilderViewV2Store>) => {
return derived([store, tables], ([$store, $tables]) => {
return derived(
[store, tables],
([$store, $tables]): DerivedViewV2Store => {
let list: ViewV2[] = []
$tables.list?.forEach(table => {
const views = Object.values(table?.views || {}).filter(
@ -33,7 +35,8 @@ export class ViewV2Store extends DerivedBudiStore<
list,
selected: list.find(view => view.id === $store.selectedViewId),
}
})
}
)
}
super(