Skip to content

setupJsdoc NPM Version

Stability: stable

Define the component's JSDoc in the script setup block.

FeaturesSupported
Volar Plugin

Basic Usage

vue
<script setup lang="tsx">
import 
Comp
from './Comp.vue'
</script> <template> <
Comp
/>
</template>

There are two places to define

  1. The first line of the script setup block.
vue
<script setup lang="ts">
/**
 * @example
 * ```vue
 * <Comp :foo="1" />
 * ```
 */

defineProps<{
  foo: number
}>()
</script>
  1. Above the export default expression.

TIP

This feature depends on exportRender, and make sure exportRender is not disabled.

vue
<script setup lang="tsx">
defineProps<{
  foo: number
}>()

/**
 * @example
 * ```vue
 * <Comp :foo="1" />
 * ```
 */
export default <div />
</script>

Volar Configuration

tsconfig.json
jsonc
{
  "vueCompilerOptions": {
    "plugins": ["unplugin-vue-macros/volar"],
  },
}

Contributors

Changelog