]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: fix dts tests
authorEvan You <yyx990803@gmail.com>
Tue, 18 Feb 2020 04:26:25 +0000 (23:26 -0500)
committerEvan You <yyx990803@gmail.com>
Tue, 18 Feb 2020 04:26:25 +0000 (23:26 -0500)
test-dts/watch.test-d.ts

index 72a38e8d02ddac83297e13ac238ebd5055275a0b..7f49691cb878f8b1b3ad28bb1621b2dd5f443fbc 100644 (file)
@@ -5,25 +5,6 @@ const source = ref('foo')
 const source2 = computed(() => source.value)
 const source3 = () => 1
 
-// eager watcher's oldValue will be undefined on first run.
-watch(source, (value, oldValue) => {
-  expectType<string>(value)
-  expectType<string | undefined>(oldValue)
-})
-
-watch([source, source2, source3], (values, oldValues) => {
-  expectType<(string | number)[]>(values)
-  expectType<(string | number | undefined)[]>(oldValues)
-})
-
-// const array
-watch([source, source2, source3] as const, (values, oldValues) => {
-  expectType<Readonly<[string, string, number]>>(values)
-  expectType<
-    Readonly<[string | undefined, string | undefined, number | undefined]>
-  >(oldValues)
-})
-
 // lazy watcher will have consistent types for oldValue.
 watch(source, (value, oldValue) => {
   expectType<string>(value)
@@ -41,7 +22,7 @@ watch([source, source2, source3] as const, (values, oldValues) => {
   expectType<Readonly<[string, string, number]>>(oldValues)
 })
 
-// source + immediate: true
+// immediate watcher's oldValue will be undefined on first run.
 watch(
   source,
   (value, oldValue) => {