Vize

type/require-typed-props

Require type definition for defineProps.

Default severity Presets Automatic fix Options
warning happy-path, nuxt, ecosystem, opinionated No None

Applies to: Type information in Vue SFC scripts and templates, for the constructs shown below.

This rule reads type information from your TypeScript project (tsconfig.json), so the configuration sets typeAware: true. typeAware does not turn on opt-in rules by itself.

Bad

The array-only defineProps(["title"]) declares title by name without giving it a type.

<script setup lang="ts">
defineProps(["title"]);
</script>

Good

defineProps<{ title: string }>() gives title an explicit string type instead of a name-only runtime declaration.

<script setup lang="ts">
defineProps<{ title: string }>();
</script>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "type/require-typed-props": "warn"
    },
    "typeAware": true
  },
});

Then run vp run lint.