Open Glandos opened 1 year ago
Maybe you could propose exporting it to the main entry of Vue 3 directly?
After a deeper look, I found this fix to be… not adequate.
The issue comes from the fact that vueused/shared references WatchOptions['flush']
. However, this flush
member doesn't exist in Vue 2. So it should be redefined in vue-demi
as an augmented interface, with type never
, as in:
declare vue {
interface WatchOptions {
flush: never
}
}
Or something similar. However, the referenced stackblitz also give the following output when running npx vue-tsc
:
node_modules/@vueuse/shared/index.d.ts:955:196 - error TS2315: Type 'WatchOptions' is not generic.
955 declare function watchArray<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T[]> | T[], cb: WatchArrayCallback<T[], Immediate extends true ? T[] | undefined : T[]>, options?: WatchOptions<Immediate>): vue_demi.WatchStopHandle;
The error is repeated multiple times, but the cause is the same: the interface is not generic. And I don't see a way to make it work reliably with a generic…
fix https://github.com/vueuse/vueuse/issues/2232
Please adjust if importing from
v3-generated
is a bad practice, but the ticket has been opened for too long, and stale-bot is a bit too fast.