Skip to content

shallowRef value incompatible with parameter of the same type #10368

Closed
@andrewbrennanfr

Description

@andrewbrennanfr

Vue version

3.3.12

Link to minimal reproduction

https://stackblitz.com/edit/vue3-vite-starter-nvhwqh?file=src%2Fissue.ts

Steps to reproduce

  • Use 3.3.12

  • Create a shallowRef with a generic type that extends an interface T extends Base

  • The value of shallowRef is incompatible as a parameter to functions that accept T

  • Reproduce the same case with 3.3.11

  • There is no issue

ℹ️ This is still an issue on 3.4.x also.

What is expected?

Here I would expect the value of my shallowRef T to be compatible with T.

What is actually happening?

Argument of type 'Base | T' is not assignable to parameter of type 'T'.

System Info

System:
  OS: macOS 14.3.1
  CPU: (8) arm64 Apple M1
  Memory: 335.19 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
  Yarn: 1.22.21 - ~/.nvm/versions/node/v20.11.0/bin/yarn
  npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
  pnpm: 8.15.1 - ~/.nvm/versions/node/v20.11.0/bin/pnpm
  bun: 1.0.15 - ~/.bun/bin/bun
  Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman
Browsers:
  Chrome: 121.0.6167.184
  Chrome Canary: 123.0.6312.0
  Edge: 121.0.2277.128
  Safari: 17.3.1
npmPackages:
  vue: ^3.3.12 => 3.3.12

Any additional comments?

Likely related to this?
#9839

And wondering if it's not related to this comment specifically?

But then how should I correct do what I've described? ☝️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions