oxc-project/oxc · error · OxcDiagnostic
Missing root type for @param.
Error message
Missing root type for @param.
What it means
Fires from jsdoc/require-param-type when the root object of a destructured parameter (e.g. `@param props` for `{a, b}`) lacks a type. The helper receives the rule's configured default type string and suggests using it for the root.
Source
Thrown at crates/oxc_linter/src/rules/jsdoc/require_param_type.rs:27
use crate::{
AstNode,
context::LintContext,
rule::{DefaultRuleConfig, Rule},
utils::{
ParamKind, collect_params, get_function_nearest_jsdoc_node, should_ignore_as_internal,
should_ignore_as_private,
},
};
fn missing_type_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Missing JSDoc `@param` type.")
.with_help("Add {type} to `@param` tag.")
.with_label(span)
}
fn missing_root_type_diagnostic(span: Span, default_type: &CompactStr) -> OxcDiagnostic {
OxcDiagnostic::warn("Missing root type for @param.")
.with_help(format!("Add {{{default_type}}} to `@param` tag."))
.with_label(span)
}
#[derive(Debug, Clone, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
pub struct RequireParamTypeConfig {
/// The type string to set by default for destructured roots. Defaults to "object".
default_destructured_root_type: CompactStr,
/// Whether to set a default destructured root type. For example, you may wish to avoid manually having to set the type for a `@param` corresponding to a destructured root object as it is always going to be an object. Uses `defaultDestructuredRootType` for the type string. Defaults to `false`.
set_default_destructured_root_type: bool,
}
impl Default for RequireParamTypeConfig {
fn default() -> Self {
Self {
default_destructured_root_type: CompactStr::from("object"),
set_default_destructured_root_type: false,View on GitHub (pinned to e1e7af627c)
Solutions
- Add a type to the root `@param`, such as the configured default (commonly `object`)
- Type the root as the shape of the destructured object
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/jsdoc/require_param_type.rs:27 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/c7fc5778a86b2a2b.
Report an issue: GitHub.