Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
1.5 KiB
Markdown
77 lines
1.5 KiB
Markdown
---
|
|
category: Reactivity
|
|
---
|
|
|
|
# extendRef
|
|
|
|
Add extra attributes to Ref.
|
|
|
|
## Usage
|
|
|
|
> Please note the extra attribute will not be accessible in Vue's template.
|
|
|
|
```ts
|
|
import { extendRef } from '@vueuse/core'
|
|
import { shallowRef } from 'vue'
|
|
|
|
const myRef = shallowRef('content')
|
|
|
|
const extended = extendRef(myRef, { foo: 'extra data' })
|
|
|
|
extended.value === 'content'
|
|
extended.foo === 'extra data'
|
|
```
|
|
|
|
Refs will be unwrapped and be reactive
|
|
|
|
```ts
|
|
import { extendRef } from '@vueuse/core'
|
|
// ---cut---
|
|
const myRef = shallowRef('content')
|
|
const extraRef = shallowRef('extra')
|
|
|
|
const extended = extendRef(myRef, { extra: extraRef })
|
|
|
|
extended.value === 'content'
|
|
extended.extra === 'extra'
|
|
|
|
extended.extra = 'new data' // will trigger update
|
|
extraRef.value === 'new data'
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export type ExtendRefReturn<T = any> = Ref<T>
|
|
export interface ExtendRefOptions<Unwrap extends boolean = boolean> {
|
|
/**
|
|
* Is the extends properties enumerable
|
|
*
|
|
* @default false
|
|
*/
|
|
enumerable?: boolean
|
|
/**
|
|
* Unwrap for Ref properties
|
|
*
|
|
* @default true
|
|
*/
|
|
unwrap?: Unwrap
|
|
}
|
|
/**
|
|
* Overload 1: Unwrap set to false
|
|
*/
|
|
export declare function extendRef<
|
|
R extends Ref<any>,
|
|
Extend extends object,
|
|
Options extends ExtendRefOptions<false>,
|
|
>(ref: R, extend: Extend, options?: Options): ShallowUnwrapRef<Extend> & R
|
|
/**
|
|
* Overload 2: Unwrap unset or set to true
|
|
*/
|
|
export declare function extendRef<
|
|
R extends Ref<any>,
|
|
Extend extends object,
|
|
Options extends ExtendRefOptions,
|
|
>(ref: R, extend: Extend, options?: Options): Extend & R
|
|
```
|