Describe the bug
Running vue-tsc in a project with vue of version 2.7 would report errors like this:
node_modules/@vueuse/shared/index.d.ts:200:26 - error TS2339: Property 'flush' does not exist on type 'WatchOptions'.
200 flush?: WatchOptions['flush'];
It seems that vue 2.7 exports WatchOptions for Options API, not for Composition API:
// node_modules/vue/types/index.d.ts
export {
...
WatchOptions,
WatchOptionsWithHandler,
DirectiveFunction,
DirectiveOptions
} from './options'
which has no flush property.
A possible fix is to re-export WatchOptions from vue/types/v3-generated in vue-demi for v2.7 like:
// vue-demi/lib/v2.7/index.d.ts
export * from 'vue'
export type { WatchOptions } from 'vue/types/v3-generated'
@antfu Any thoughts?
Reproduction
https://stackblitz.com/edit/vitejs-vite-z2pxyv?file=src/a.ts
Run npx vue-tsc
System Info
@vueuse/core: ^9.2.0 => 9.2.0
vue: ^2.7.3 => 2.7.10
on StackBlitz
Used Package Manager
npm
Validations
Describe the bug
Running
vue-tscin a project withvueof version 2.7 would report errors like this:It seems that vue 2.7 exports
WatchOptionsfor Options API, not for Composition API:which has no
flushproperty.A possible fix is to re-export
WatchOptionsfromvue/types/v3-generatedinvue-demifor v2.7 like:@antfu Any thoughts?
Reproduction
https://stackblitz.com/edit/vitejs-vite-z2pxyv?file=src/a.ts
Run
npx vue-tscSystem Info
Used Package Manager
npm
Validations