Skip to content

Parameters of type 'T' cannot be assigned to parameters of type 'UnwrapRefSimple<T>'. ts(2345) #13755

@WangJincheng4869

Description

@WangJincheng4869

Vue version

3.5.18

Link to minimal reproduction

https://play.vuejs.org/#eNp9Uc1OAjEQfpWxFyDRJUZPuJCoIVEPapTEA+VAltml2G2b/qwkm313p92AHAyXpvP9tN/MtOzemKwJyCYsd4UVxoNDH8yMK1EbbT20YLGEDkqraxiQdMAVV2VQhRdagUfn88VsOIKWK4BCK+dBCjqm0ZgvlqvZcLka3Z2yEyCYBMtVgqM8a9YyYGaC2w6zLJMiOrr4VW+qXdW/OBw8oZQavrSVm4vBiKt83CenzFR4rI1ce6QKIN9ez9o2mbsuH1OVUKFM8NBc1XqDcsoZ8ZzBmMh8fOJnl8w7+r4UVbZzWtGQUpOcFbo2QqJ9M3EIjrNJ337k1pTu5yVh3ga8PODFFovvf/Cd20eMs3eLDm2DnB05v7YV+p6ef77inu5HktIHSeoz5Ac6LUPM2MsegtpQ7BNdSvucVi1UtXDzvUflDk3FoFHZJT1ntP7HM63/xb3JbpOPdsi6XyGEyoc=

Steps to reproduce

function test<T>() {
  const list = ref<T[]>([]);
  const li: T[] = [];
  list.value.push(...li);
}
Image

What is expected?

The type should actually be the same, there should be no errors reported

What is actually happening?

The element type within ref has an extra layer of UnwrapRefSimple, causing an error that prevents inserting the element into the array.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 9 7940H  w/ Radeon 780M Graphics     
    Memory: 6.82 GB / 31.22 GB
  Binaries:
    Node: 22.17.1 - D:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - D:\Program Files\nodejs\npm.CMD
    pnpm: 10.14.0 - D:\Users\jcwang\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (133.0.3065.69)
    Internet Explorer: 11.0.26100.1882

Any additional comments?

I am unable to distinguish whether it is a problem with Vue or a problem with the Vue language tool. I have submitted two copies language-tools

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