Repository: vuejs/composition-api (ts)

Issue:
triggerRef stopped working with watch-multiple
Since [@vue/composition-api@1.1.2](https://github.com/vuejs/composition-api/releases/tag/v1.1.2), `triggerRef` stopped triggering `watch` when watching an array of shallow refs. It appears to be caused by https://github.com/vuejs/composition-api/pull/791.

Here's a [code sandbox](https://codesandbox.io/s/vue-triggerref-and-watch-multiple-bug-jxpii) demonstrating the issue. If you switch `@vue/composition` back to version 1.1.1, the same example will work correctly and consistently.

Pull request:
fix(api-watch): watching nested ref array w/ deep doesn't work
close #805 

I personally think that the combination of the `Reactivity` API with the `Watch` API provides great flexibility, but also leads to very complex boundary condition handling, so perhaps the best we can do now is to find and solve problems to achieve higher test coverage～

Patch:
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..868cc2b
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,27 @@
+# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
+#
+# You can adjust the behavior by modifying this file.
+# For more information, see:
+# https://github.com/actions/stale
+name: Mark stale issues and pull requests
+
+on:
+  schedule:
+  - cron: '39 23 * * *'
+
+jobs:
+  stale:
+
+    runs-on: ubuntu-latest
+    permissions:
+      issues: write
+      pull-requests: write
+
+    steps:
+    - uses: actions/stale@v3
+      with:
+        repo-token: ${{ secrets.GITHUB_TOKEN }}
+        stale-issue-message: 'Stale issue message'
+        stale-pr-message: 'Stale pull request message'
+        stale-issue-label: 'no-issue-activity'
+        stale-pr-label: 'no-pr-activity'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 02d50fd..eb5ebec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+<a name="1.1.4"></a>
+## [1.1.4](https://github.com/vuejs/composition-api/compare/v1.1.3...v1.1.4) (2021-08-31)
+
+
+### Bug Fixes
+
+* **types:** align emits type with vue-next ([565cbd1](https://github.com/vuejs/composition-api/commit/565cbd1))
+
+
+
 <a name="1.1.3"></a>
 ## [1.1.3](https://github.com/vuejs/composition-api/compare/v1.1.2...v1.1.3) (2021-08-22)
 
diff --git a/README.md b/README.md
index 09685d0..c57faa5 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ Include `@vue/composition-api` after Vue and it will install itself automaticall
 <!--cdn-links-start-->
 ```html
 <script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script>
-<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.1.3"></script>
+<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.1.4"></script>
 ```
 <!--cdn-links-end-->
 
diff --git a/README.zh-CN.md b/README.zh-CN.md
index f4e7f89..ba8e01f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -40,7 +40,7 @@ import { ref, reactive } from '@vue/composition-api'
 <!--cdn-links-start-->
 ```html
 <script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script>
-<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.1.3"></script>
+<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.1.4"></script>
 ```
 <!--cdn-links-end-->
 
diff --git a/package.json b/package.json
index 6755002..a6ab35c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@vue/composition-api",
-  "version": "1.1.3",
+  "version": "1.1.4",
   "description": "Provide logic composition capabilities for Vue.",
   "keywords": [
     "vue",
diff --git a/src/apis/watch.ts b/src/apis/watch.ts
index 83522ae..91f68c3 100644
--- a/src/apis/watch.ts
+++ b/src/apis/watch.ts
@@ -341,7 +341,11 @@ function createWatcher(
   }
 
   const applyCb = (n: any, o: any) => {
-    if (isMultiSource && n.every((v: any, i: number) => Object.is(v, o[i])))
+    if (
+      !deep &&
+      isMultiSource &&
+      n.every((v: any, i: number) => Object.is(v, o[i]))
+    )
       return
     // cleanup before running cb again
     runCleanup()
diff --git a/src/component/componentOptions.ts b/src/component/componentOptions.ts
index 117cd51..2108345 100644
--- a/src/component/componentOptions.ts
+++ b/src/component/componentOptions.ts
@@ -8,6 +8,13 @@ export { ComponentPropsOptions } from './componentProps'
 export type ComputedGetter<T> = (ctx?: any) => T
 export type ComputedSetter<T> = (v: T) => void
 
+export type ObjectEmitsOptions = Record<
+  string,
+  ((...args: any[]) => any) | null
+>
+
+export type EmitsOptions = ObjectEmitsOptions | string[]
+
 export interface WritableComputedOptions<T> {
   get: ComputedGetter<T>
   set: ComputedSetter<T>
@@ -63,7 +70,7 @@ export type ComponentOptionsWithProps<
   Props = ExtractPropTypes<PropsOptions>
 > = ComponentOptionsBase<Props, D, C, M> & {
   props?: PropsOptions
-  emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
+  emits?: (EmitsOptions | string[]) & ThisType<void>
   setup?: SetupFunction<Props, RawBindings>
 } & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>
 
@@ -76,7 +83,7 @@ export type ComponentOptionsWithArrayProps<
   Props = Readonly<{ [key in PropNames]?: any }>
 > = ComponentOptionsBase<Props, D, C, M> & {
   props?: PropNames[]
-  emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
+  emits?: (EmitsOptions | string[]) & ThisType<void>
   setup?: SetupFunction<Props, RawBindings>
 } & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>
 
@@ -88,7 +95,7 @@ export type ComponentOptionsWithoutProps<
   M extends MethodOptions = {}
 > = ComponentOptionsBase<Props, D, C, M> & {
   props?: undefined
-  emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
+  emits?: (EmitsOptions | string[]) & ThisType<void>
   setup?: SetupFunction<Props, RawBindings>
 } & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>
 


Test patch:
diff --git a/test/v3/runtime-core/apiWatch.spec.ts b/test/v3/runtime-core/apiWatch.spec.ts
index d1f440a..f71bcd0 100644
--- a/test/v3/runtime-core/apiWatch.spec.ts
+++ b/test/v3/runtime-core/apiWatch.spec.ts
@@ -572,4 +572,14 @@ describe('api: watch', () => {
     await nextTick()
     expect(dummy).toEqual([1, 2])
   })
+
+  // #805 #807
+  it('watching sources: [ref<[]>] w/ deep', async () => {
+    const foo = ref([1])
+    const cb = jest.fn()
+    watch([foo], cb, { deep: true })
+    foo.value.push(2)
+    await nextTick()
+    expect(cb).toBeCalledTimes(1)
+  })
 })