{"record":{"id":"950fde5ac57fc661","repo":"oxc-project/oxc","slug":"specify-type-parameter-for-name-function-othe","errorCode":null,"errorMessage":"Specify type parameter for `{name}` function, otherwise created variable will not be typechecked.","messagePattern":"Specify type parameter for `(.+?)` function, otherwise created variable will not be typechecked\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/require_typed_ref.rs","lineNumber":12,"sourceCode":"use oxc_ast::{AstKind, ast::Argument};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn require_typed_ref_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    let msg = format!(\n        \"Specify type parameter for `{name}` function, otherwise created variable will not be typechecked.\"\n    );\n    OxcDiagnostic::warn(msg)\n        .with_help(\"Provide an explicit type parameter or an initial value.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct RequireTypedRef;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Require `ref` and `shallowRef` functions to be strongly typed.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// With TypeScript it is easy to prevent usage of `any` by using `noImplicitAny`.\n    /// Unfortunately this rule is easily bypassed with Vue `ref()` function.\n    /// Calling `ref()` function without a generic parameter or an initial value leads to ref having `Ref<any>` type.\n    ///","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/require_typed_ref.rs#L1-L30","documentation":"Emitted by run of the vue require-typed-ref rule when ref() or shallowRef() is called without an initial value or an explicit type parameter. Without either, the created variable is typed loosely (null/undefined inferred) and loses type checking on later use.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/vue/require_typed_ref.rs:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide an initial value, e.g. ref(0)","Add an explicit type parameter, e.g. ref<string | null>(null)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}