docs: add advanced skills for Vitest, Pinia, and Vue built-ins
Add comprehensive reference documentation for: - Vitest: environments, projects/workspaces, type testing, vi utilities - Pinia: HMR, Nuxt integration, SSR setup - Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
This commit is contained in:
31
.agents/skills/vueuse-functions/references/isDefined.md
Normal file
31
.agents/skills/vueuse-functions/references/isDefined.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
category: Utilities
|
||||
---
|
||||
|
||||
# isDefined
|
||||
|
||||
Non-nullish checking type guard for Ref.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { isDefined } from '@vueuse/core'
|
||||
|
||||
const example = ref(Math.random() ? 'example' : undefined) // Ref<string | undefined>
|
||||
|
||||
if (isDefined(example))
|
||||
example // Ref<string>
|
||||
```
|
||||
|
||||
## Type Declarations
|
||||
|
||||
```ts
|
||||
export type IsDefinedReturn = boolean
|
||||
export declare function isDefined<T>(
|
||||
v: ComputedRef<T>,
|
||||
): v is ComputedRef<Exclude<T, null | undefined>>
|
||||
export declare function isDefined<T>(
|
||||
v: Ref<T>,
|
||||
): v is Ref<Exclude<T, null | undefined>>
|
||||
export declare function isDefined<T>(v: T): v is Exclude<T, null | undefined>
|
||||
```
|
||||
Reference in New Issue
Block a user