oxc-project/oxc · error · OxcDiagnostic

Use new type literal declaration instead of the old call sig

Error message

Use new type literal declaration instead of the old call signature declaration

What it means

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.

Source

Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:29

use crate::{
    AstNode,
    context::{ContextHost, LintContext},
    frameworks::FrameworkOptions,
    rule::{DefaultRuleConfig, Rule},
};

fn has_arg_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Use type based declaration instead of runtime declaration")
        .with_label(span)
}

fn has_type_arg_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Use runtime declaration instead of type based declaration")
        .with_label(span)
}

fn has_type_call_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(
        "Use new type literal declaration instead of the old call signature declaration",
    )
    .with_label(span)
}

#[derive(Debug, Default, Clone, JsonSchema, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
enum DeclarationStyle {
    /// Enforces the use of a named TypeScript type or interface as the
    /// argument to `defineEmits`, e.g. `defineEmits<MyEmits>()`.
    #[default]
    TypeBased,
    /// Enforces the use of an inline type literal as the argument to
    /// `defineEmits`, e.g. `defineEmits<{ (event: string): void }>()`.
    TypeLiteral,
    /// Enforces the use of runtime declaration, where emits are declared
    /// using an array or object, e.g. `defineEmits(['event1', 'event2'])`.
    Runtime,

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Rewrite the call-signature type into an event map, e.g. defineEmits<{ change: [value: number] }>()
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/b257c780652a4f8d. Report an issue: GitHub.