{"record":{"id":"c5d21b5ecd8fa14c","repo":"oxc-project/oxc","slug":"use-type-based-declaration-instead-of-runtime-decl","errorCode":null,"errorMessage":"Use type based declaration instead of runtime declaration","messagePattern":"Use type based declaration instead of runtime declaration","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/define_emits_declaration.rs","lineNumber":19,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{TSSignature, TSType},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse 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 {","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/define_emits_declaration.rs#L1-L37","documentation":"Emitted by the vue define-emits-declaration rule when a defineEmits macro call uses a runtime declaration (an options array or object argument) while the rule is configured to require type-based declarations. It is a consistency guard enforcing one declaration style per codebase.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace the runtime array/object argument with a type literal such as defineEmits<{ (e: 'change', value: number): void }>() or the shorthand call-signature form","Configure the rule to allow runtime declarations if that style is 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"}