8000 Refs from composables are misinterpreted in v3.0.0-alpha.6 · Issue #5367 · vuejs/language-tools · GitHub
[go: up one dir, main page]

Skip to content

Refs from composables are misinterpreted in v3.0.0-alpha.6 #5367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rodrigocfd opened this issue May 17, 2025 · 1 comment
Closed

Refs from composables are misinterpreted in v3.0.0-alpha.6 #5367

rodrigocfd opened this issue May 17, 2025 · 1 comment
Labels
question Further information is requested

Comments

@rodrigocfd
Copy link
rodrigocfd commented May 17, 2025

Vue - Official extension or vue-tsc version

Extension v3.0.0-alpha6 ; vue-tsc 2.2.10

VSCode version

1.100.2

Vue version

3.5.14

TypeScript version

5.8.3

System Info

System:
    OS: Linux 5.15 Linux Mint 21.3 (Virginia)
    CPU: (6) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 5.38 GB / 10.67 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.15.0 - ~/apps/node/bin/node
    npm: 11.4.0 - ~/apps/node/bin/npm

Steps to reproduce

Create this child component:

<script setup lang="ts">
const props = defineProps<{
    name: string;
}>();
</script>

<template>
    <h2>This is the component</h2>
    <div>{{props.name}}</div>
</template>

And the hosting component:

<script setup lang="ts">
import {ref} from 'vue';
import Component from './Component.vue';

// --- This works ---

const theName = ref('foo');

// --- This doesn't work ---

function useFoo() {
    const name = ref('foo');
    return {name};
}
const foo = useFoo();
</script>

<template>
    <Component :name="theName" />
    <Component :name="foo.name" /> <!-- error here  -->
</template>

What is expected?

No errors.

What is actually happening?

The extension is showing an error, asking me to use .value if the ref comes from a composable. If the ref was declared in the script setup block – that is, not coming from a composable –, the error doesn't show.

Image

Any additional comments?

This error happens in v3.0.0-alpha.6 (#5261), it seems that it cannot recognize a ref coming from a composable. If the ref is declared within the script setup block, it is parsed correctly.

I attached a project with the minimal reproduction scenario:

composable-bug.zip

@KazariEX
Copy link
Member

@KazariEX KazariEX closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2025
@KazariEX KazariEX added question Further information is requested and removed pending triage labels May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants
0