Skip to content

watch should type old value as possibly undefined #253

@zippaaa

Description

@zippaaa

Docs: https://vue-composition-api-rfc.netlify.com/api.html#watch (Watching Multiple Sources)
Test:

setup() {
    const test = ref({a: 0, b: 0}); //reactive({a: 0, b: 0});
    watch(
        () => [test.a, test.b],
        ([newA, newB], [oldA, oldB]) => console.log(newA, oldA, newB, oldB)
    );
}

Result
изображение

Test:

setup() {
    const test = reactive({a: 0, b: 0});
    watch(
        () => [test.a, test.b],
        (newValues, oldValues) => console.log(newValues, oldValues)
    );
}

Result:
Array[0, 0], undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions