{"record":{"id":"2c340febb688a1c6","repo":"oxc-project/oxc","slug":"use-runtime-declaration-instead-of-type-based-decl","errorCode":null,"errorMessage":"Use runtime declaration instead of type based declaration","messagePattern":"Use runtime declaration instead of type based declaration","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/define_emits_declaration.rs","lineNumber":24,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    frameworks::FrameworkOptions,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn has_arg_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Use type based declaration instead of runtime declaration\")\n        .with_label(span)\n}\n\nfn has_type_arg_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Use runtime declaration instead of type based declaration\")\n        .with_label(span)\n}\n\nfn has_type_call_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Use new type literal declaration instead of the old call signature declaration\",\n    )\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, JsonSchema, Serialize, Deserialize)]\n#[serde(rename_all = \"kebab-case\")]\nenum DeclarationStyle {\n    /// Enforces the use of a named TypeScript type or interface as the\n    /// argument to `defineEmits`, e.g. `defineEmits<MyEmits>()`.\n    #[default]\n    TypeBased,\n    /// Enforces the use of an inline type literal as the argument to","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/define_emits_declaration.rs#L6-L42","documentation":"Emitted by has_type_arg_diagnostic in the vue define-emits-declaration rule when defineEmits uses a type argument while the rule is configured to require runtime declarations. It is the inverse of the type-based guard, enforcing a consistent runtime declaration style.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the type parameter with a runtime declaration, e.g. defineEmits(['change']) or defineEmits({ change: null })","Switch the rule configuration to type-based declarations if preferred"],"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"}