{"record":{"id":"b52edf6c6ece0547","repo":"oxc-project/oxc","slug":"missing-argument-type-on-function","errorCode":null,"errorMessage":"Missing argument type on function","messagePattern":"Missing argument type on function","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/typescript/explicit_module_boundary_types.rs","lineNumber":33,"sourceCode":"use schemars::JsonSchema;\nuse serde::Deserialize;\nuse serde_json::Value;\nuse smallvec::SmallVec;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn func_missing_return_type(fn_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing return type on function\")\n        .with_help(\"Define an explicit return type for the function.\")\n        .with_label(fn_span)\n}\n\nfn func_missing_argument_type(param_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing argument type on function\")\n        .with_help(\"Define an explicit argument type for each argument.\")\n        .with_label(param_span)\n}\n\nfn func_argument_is_explicitly_any(param_span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Argument is explicitly typed as `any`\")\n        .with_help(\n            \"Avoid explicit `any` at module boundaries; prefer `unknown` and narrow before use.\",\n        )\n        .with_label(param_span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct ExplicitModuleBoundaryTypes(Box<ExplicitModuleBoundaryTypesConfig>);\n\nimpl Deref for ExplicitModuleBoundaryTypes {\n    type Target = ExplicitModuleBoundaryTypesConfig;\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/explicit_module_boundary_types.rs#L15-L51","documentation":"Argument-side diagnostic of typescript/explicit-module-boundary-types: parameters of exported functions and public class members must carry explicit type annotations. Implicit any at a boundary hides the input contract from consumers and defeats the point of the rule. The same allowedNames/allow* exemptions apply as for the return-type variant.","triggerScenarios":"`export function parse(input) { ... }` or a public method with an untyped parameter on an exported class; destructured or rest parameters without annotations are also flagged; constructors are treated as implementation details and set-accessors are skipped by the checker.","commonSituations":"Migrating a JS module to TS one function at a time; default parameters relying on inference (`export const f = (n = 1) => n`); callbacks exported without parameter types.","solutions":["Annotate each parameter: `export function parse(input: string) { ... }`","When the shape is genuinely unknown, use `unknown` and narrow inside the function instead of leaving it implicit","Exempt specific names via \"allowedNames\" if a function cannot be annotated yet"],"exampleFix":"// before\nexport function greet(name) {\n  return `hello ${name}`;\n}\n\n// after\nexport function greet(name: string): string {\n  return `hello ${name}`;\n}","handlingStrategy":"validation","validationCode":"// .oxlintrc.json\n{\n  \"rules\": {\n    \"typescript/explicit-module-boundary-types\": [\n      \"warn\", { \"allowArgumentsExplicitlyTypedAsAny\": false }\n    ]\n  }\n}\n\n// tsconfig.json — let the compiler catch implicit any too\n{ \"compilerOptions\": { \"noImplicitAny\": true } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable noImplicitAny so untyped boundary parameters fail compilation, not just lint","Write exported function signatures top-down (parameters first) so annotation is the default habit","For dynamic payloads, define request/response interfaces at the edge instead of relying on inference"],"tags":["typescript","lint","annotations","parameters","implicit-any","oxlint"],"backgroundTag":"missing-parameter-type-annotation","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}