{"record":{"id":"b257c780652a4f8d","repo":"oxc-project/oxc","slug":"use-new-type-literal-declaration-instead-of-the-ol","errorCode":null,"errorMessage":"Use new type literal declaration instead of the old call signature declaration","messagePattern":"Use new type literal declaration instead of the old call signature declaration","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/define_emits_declaration.rs","lineNumber":29,"sourceCode":"use 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\n    /// `defineEmits`, e.g. `defineEmits<{ (event: string): void }>()`.\n    TypeLiteral,\n    /// Enforces the use of runtime declaration, where emits are declared\n    /// using an array or object, e.g. `defineEmits(['event1', 'event2'])`.\n    Runtime,","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/define_emits_declaration.rs#L11-L47","documentation":"Emitted by has_type_call_diagnostic in the vue define-emits-declaration rule when a type-based defineEmits declaration uses the older call-signature style (event functions) instead of the newer object type-literal event map syntax. It is a style guard pushing for the modern declaration form.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite the call-signature type into an event map, e.g. defineEmits<{ change: [value: 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-14T00:17:10.932Z"}