Subscribe on changes!

`$watch` callback is not strongly typed, unlike `watch` which is

avatar
Jun 17th 2022

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-mfhxkx?file=src%2Fmain.ts&terminal=dev

Steps to reproduce

Setup a watcher with this.$watch using a function as the source.

What is expected?

The callback's parameters are typed based on the source, like they were in vue2 and like they are with watch.

What is actually happening?

The callback's parameters are typed as any.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz 
    Memory: 10.02 GB / 31.94 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE       
    Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 102.0.5005.115
    Edge: Spartan (44.19041.1266.0), Chromium (102.0.1245.41)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vue: ^3.2.34 => 3.2.37

Any additional comments?

No response