Open nicojmb opened 2 years ago
The typing of useObservable had become incompatible but the runtime is correct.
The typings used to work with rxjs@6 but not rxjs@7. After adjusting typings for rxjs@7 it works less good for rxjs@6. This will work better when vueuse upgrades to rxjs@7. Until then, it seems you need an explicit cast:
useObservable (liveQuery (...) as any)
I've run into this same problem. However, the only explicit cast I can get to work is any
. In the friends
example above (or my customers
below), is there a cast other than any
that would work?
Additionally, I find that I also need to explicitly typecast useObservable
with Ref
, or it causes problems when I want to reference this.customers
(in my example).
data() {
return {
authorized: false,
sectionName: "RepairTagger",
customers: useObservable(
liveQuery(() => db.customers.toArray()) as any
) as Ref<Customer[]>,
customerQuery: {
limit: 20,
sort: ['first_name'] as Array<keyof Customer>
}
}
},
Yeah the vue demo does not work.
First of all I need to add lang="ts"
to Githubissues.
Hi,
I tried to use Dexie with Vue 3 and typescript, but get error with "UseObservable" method:
Im' trying to find examples but not finded :(