chore: fix dts tests
This commit is contained in:
parent
2fb7a63943
commit
cb03362b08
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user