Skip to content

Support ref unwrapping in state #491

@posva

Description

@posva

Currently, passing a ref to the state is unwrapped because the store is a reactive object but the types do not reflect it:

const useStore = defineStore({ state: () => ({ n: ref(0) }) })

const store = useStore()
store.n // Ref<number> instead of number (the actual type)

This is useful to use external use* functions: #485 (reply in thread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions