Vize

script/require-prop-type-constructor

Require prop type values to be constructors rather than string literals.

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

Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form.

Bad

The prop declarations use strings "String" and "Number" as runtime types, including inside the constructor array. Those strings are not constructor functions.

<script lang="ts">
export default {
  props: {
    // The type should be the `String` constructor, not the string "String".
    name: "String",
    age: { type: "Number" },
    id: { type: ["String", "Number"] }
  }
}
</script>

Good

The declarations use the actual String and Number identifiers, including the union array [String, Number].

<script lang="ts">
export default {
  props: {
    name: String,
    age: { type: Number },
    id: { type: [String, Number] }
  }
}
</script>

Configuration (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "script/require-prop-type-constructor": "error"
    }
  },
});

Then run vp run lint.