📄 createRef¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 1 |
| 📦 Imports | 4 |
| 📑 Type Aliases | 2 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/shared/createRef/index.ts
📦 Imports¶
| Name | Source |
|---|---|
Ref |
vue |
ShallowRef |
vue |
deepRef |
vue |
shallowRef |
vue |
Functions¶
createRef(value: T, deep: D): CreateRefReturn<T, D>¶
Returns a deepRef or shallowRef depending on the deep param.
Parameters:
valueany: No descriptiondeepany: No description
Returns: undefined
the deepRef or shallowRef
Examples:
Tags: @__NO_SIDE_EFFECTS__
Raw JSDoc
/**
* Returns a `deepRef` or `shallowRef` depending on the `deep` param.
*
* @example createRef(1) // ShallowRef<number>
* @example createRef(1, false) // ShallowRef<number>
* @example createRef(1, true) // Ref<number>
* @example createRef("string") // ShallowRef<string>
* @example createRef<"A"|"B">("A", true) // Ref<"A"|"B">
*
* @param value
* @param deep
* @returns the `deepRef` or `shallowRef`
*
* @__NO_SIDE_EFFECTS__
*/
Calls:
deepRef (from vue)shallowRef (from vue)
Code
Type Aliases¶
CreateRefReturn<T = any, D extends boolean = false>¶
ShallowOrDeepRef<T = any, D extends boolean = false>¶
type ShallowOrDeepRef<T = any, D extends boolean = false> = D extends true ? Ref<T> : ShallowRef<T>;
Generated by Syntax Scribe