]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: fix failed typings?
authorpikax <david-181@hotmail.com>
Sat, 4 Jan 2020 14:22:09 +0000 (14:22 +0000)
committerpikax <david-181@hotmail.com>
Sat, 4 Jan 2020 14:24:34 +0000 (14:24 +0000)
packages/runtime-core/__tests__/apiTemplateRef.spec.ts
packages/runtime-core/src/apiWatch.ts

index d164d4571b29708eb80e34490890db5a1fa07291..f9b6b1b5856b031a3431e107f7b0fe20a9d2d19d 100644 (file)
@@ -4,7 +4,6 @@ import {
   h,
   render,
   nextTick,
-  Ref,
   createComponent
 } from '@vue/runtime-test'
 
@@ -142,7 +141,7 @@ describe('api: template refs', () => {
       foo: ref(null),
       bar: ref(null)
     }
-    const refKey: Ref<keyof typeof refs> = ref('foo')
+    const refKey = ref<keyof typeof refs>('foo')
 
     const Comp = {
       setup() {
index efd3dfd40a4f9ee4272be88257626060e453c405..a3fd6acfaeb92399f4d94d4fe50cb8ab71229eea 100644 (file)
@@ -72,7 +72,10 @@ export function watch<T>(
 // Readonly constraint helps the callback to correctly infer value types based
 // on position in the source array. Otherwise the values will get a union type
 // of all possible value types.
-export function watch<T extends Readonly<WatcherSource<unknown>[]>>(
+export function watch<
+  T extends Readonly<WatcherSource<TArgs>>,
+  TArgs extends Array<any> = any[]
+>(
   sources: T,
   cb: WatchHandler<MapSources<T>>,
   options?: WatchOptions