Skip to content
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

Vue TSC & computed-refs #4350

Open
louis49 opened this issue May 7, 2024 · 2 comments
Open

Vue TSC & computed-refs #4350

louis49 opened this issue May 7, 2024 · 2 comments

Comments

@louis49
Copy link

louis49 commented May 7, 2024

I do not understand why this have an error with transpiling with vue-tsc :

import { computed, ComputedRef, UnwrapNestedRefs } from "vue";

interface ConcreteTest {
    val: ComputedRef<string>;
}

interface Store {
    registers: ConcreteTest[];
}

class StoreManager {
    public store: UnwrapNestedRefs<Store> = {
        registers: []
    };

    addRegisters(){
        const val = computed(() => { return "0xaa" });
        this.store.registers.push({ val }); // => The expected type comes from property 'val' which is declared here on type '{ val: string; }'
    }
}

You can check it here : https://github.com/louis49/demo-vue-ts-computed-refs.git with npm build

@so1ve
Copy link
Member

so1ve commented May 8, 2024

This is likely a vue core issue

@teleskop150750
Copy link

Попробуй убрать UnwrapNestedRefs. Или { val: val.value}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants