When writing Vue (including Nuxt) code snippets or API docs, ensure the example is correct for the shapes the API truly supports and for the Nuxt/Vue environment.
Ref). If the API accepts reactive values and getters/computed, type it accordingly (e.g., MaybeRefOrGetter) and normalize when you need an actual value.#imports), so the snippet works when copied.Example (typing + normalization for reactive inputs):
import { computed, type MaybeRefOrGetter, type Ref } from 'vue'
import { toValue } from 'vue'
function useTodos(todoId: MaybeRefOrGetter<string>) {
const normalizedId: Ref<string> = computed(() => toValue(todoId))
// ...use normalizedId.value where a plain string is needed
}
Nuxt 3 import alias (plugin/snippet correctness):
import { defineNuxtPlugin, useState } from '#imports'
This keeps docs precise and copy-pastable rather than only “almost correct” for real-world reactive inputs or Nuxt runtime resolution.