Vue · Style

VUE0016Prefer TypeScript props declarations

Use type-only defineProps declarations in TypeScript <script setup> components.

Why it happens

Runtime prop declarations duplicate information TypeScript can already express, and they make prop contracts harder to reuse across components, composables, and tests.

Fix

Use defineProps<Props>() or defineProps<{ foo: string }>() instead of runtime props objects when the component already uses TypeScript.

Example

Declare props with TypeScript

Before

<script setup lang="ts">
const props = defineProps({
  title: String,
  count: Number,
})
</script>

After

<script setup lang="ts">
interface Props {
  title: string
  count?: number
}

const props = defineProps<Props>()
</script>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework vue --rules vue/style/prefer-type-props
Copyright © 2026