oxc-project/oxc · error · OxcDiagnostic
Use runtime declaration instead of type based declaration
Error message
Use runtime declaration instead of type based declaration
What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:24
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 {
/// 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 toView on GitHub (pinned to e1e7af627c)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/vue/define_emits_declaration.rs:24 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/2c340febb688a1c6.
Report an issue: GitHub.