| 129 | |
| 130 | // implementation |
| 131 | export function watch<T = any, Immediate extends Readonly<boolean> = false>( |
| 132 | source: T | WatchSource<T>, |
| 133 | cb: any, |
| 134 | options?: WatchOptions<Immediate>, |
| 135 | ): WatchHandle { |
| 136 | if (__DEV__ && !isFunction(cb)) { |
| 137 | warn( |
| 138 | `\`watch(fn, options?)\` signature has been moved to a separate API. ` + |
| 139 | `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` + |
| 140 | `supports \`watch(source, cb, options?) signature.`, |
| 141 | ) |
| 142 | } |
| 143 | return doWatch(source as any, cb, options) |
| 144 | } |
| 145 | |
| 146 | function doWatch( |
| 147 | source: WatchSource | WatchSource[] | WatchEffect | object, |