Skip to content

Nested array refs type errors #11548

@cnzgray

Description

@cnzgray

Vue version

3.4.35

Link to minimal reproduction

https://play.vuejs.org/#eNp9kcFuwjAMhl/FyoVVQi2U7VI6pG3isE0a0+BG0FSKYWVtEiVph4T67nNSDThMXKLY32/rt31kD0qFTY0sYanJdaEsGLS1mnBRVEpqC0fQuIUWtlpW0CNpjwsucimMhQzuHb05cgGwTvx/EPRdlHfR0j3DoO+DOFgFXLTB2HXIwiYrawzX1GM4hiiC2es5my8HKwKxB4t5AvEojl1ZGnU2ySAFFitVZhYpAkg3RTNJI/c63QVjfWYNWd4Wu3BvpKBpvWXOclmpokQ9U7agkThLwBPHsrKUPy8+Z3WNfixf84X59z/5vTm4HGfvGg3qBjk7MZvpHdoOT+dveKD/CVZyU5ekvgI/0Miydh472WMtNmT7QufdPvubFWK3MNODRWH+hnJGnbL1es7ojk9XRj/bHYW3vo7uRlv8bFC7nrRAAuHojrW/e2S5SQ==

Steps to reproduce

PR #11442 is not just a TS>5.1 issue; it also requires additional testing for nested Ref arrays.

What is expected?

a.value.b = 1; // OK

a.value.c[0] = 2; // OK

What is actually happening?

a.value.b = 1; // OK

a.value.c[0] = 2; // TS Error 2322

System Info

System:
    OS: macOS 13.6.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 24.11 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.16.0 - ~/.nvs/node/20.16.0/x64/bin/node
    Yarn: 1.22.22 - ~/.nvs/node/20.16.0/x64/bin/yarn
    npm: 10.8.2 - ~/.nvs/node/20.16.0/x64/bin/npm
    pnpm: 9.6.0 - ~/.nvs/node/20.16.0/x64/bin/pnpm
  Browsers:
    Chrome: 127.0.6533.90
    Safari: 17.5

Any additional comments?

https://vuejs.org/api/reactivity-core.html#ref

If an object is assigned as a ref's value, the object is made deeply reactive with reactive(). This also means if the object contains nested refs, they will be deeply unwrapped.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions