oxc-project/oxc · error · OxcDiagnostic
Use type based declaration instead of runtime declaration
Error message
Use type based declaration instead of runtime declaration
What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:19
use oxc_ast::{
AstKind,
ast::{TSSignature, TSType},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
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 {View on GitHub (pinned to e1e7af627c)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:19 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/c5d21b5ecd8fa14c.
Report an issue: GitHub.