Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/makeDestructurable.md
1---2category: Utilities3---45# makeDestructurable67Make isomorphic destructurable for object and array at the same time. See [this blog](https://antfu.me/posts/destructuring-with-object-or-array/) for more details.89## Usage1011TypeScript Example:1213```ts twoslash include main14import { makeDestructurable } from '@vueuse/core'1516const foo = { name: 'foo' }17const bar = 10241819const obj = makeDestructurable(20{ foo, bar } as const,21[foo, bar] as const,22)23```2425Usage:2627```ts twoslash28// @include: main29// ---cut---30let { foo, bar } = obj31let [foo, bar] = obj32```3334## Type Declarations3536```ts37export declare function makeDestructurable<38T extends Record<string, unknown>,39A extends readonly any[],40>(obj: T, arr: A): T & A41```42