{"record":{"id":"47752bbb9003eb44","repo":"oxc-project/oxc","slug":"the-prop-name-property-should-be-a-constructor","errorCode":null,"errorMessage":"The \"{prop_name}\" property should be a constructor.","messagePattern":"The \"(.+?)\" property should be a constructor\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_prop_type_constructor.rs","lineNumber":23,"sourceCode":"        TemplateLiteral,\n    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse oxc_syntax::identifier::is_identifier_name;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::{RuleFix, RuleFixer},\n    frameworks::FrameworkOptions,\n    rule::Rule,\n    utils::{find_property, is_vue_component_options_object_excluding_instance},\n};\n\nfn require_prop_type_constructor_diagnostic(prop_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"The \\\"{prop_name}\\\" property should be a constructor.\"))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequirePropTypeConstructor;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Require `props` type values to be a constructor function (e.g. `String`,\n    /// `Number`, `Boolean`) rather than a string, number, or other literal.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Vue uses the prop type for runtime validation and dev-time warnings. A\n    /// string like `'String'` looks like the constructor but is never matched\n    /// against an actual value, silently disabling the check.\n    ///","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_prop_type_constructor.rs#L5-L41","documentation":"Emitted by check_and_report in the vue require-prop-type-constructor rule when a prop's type entry in the props definition is a string or expression that is not a native constructor (String, Number, Boolean, Function, Object, Array, Symbol or a class/constructor function). Vue relies on constructors for prop validation, so arbitrary values break it.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_prop_type_constructor.rs:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a constructor for the prop type, e.g. props: { count: Number }","For custom classes, reference the class constructor directly instead of a string name","List multiple constructors in an array, e.g. type: [String, Number]"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}