{"record":{"id":"cce87083f21d33d3","repo":"oxc-project/oxc","slug":"do-not-use-wrapper-object-types","errorCode":null,"errorMessage":"Do not use wrapper object types.","messagePattern":"Do not use wrapper object types\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/typescript/no_wrapper_object_types.rs","lineNumber":10,"sourceCode":"use cow_utils::CowUtils;\nuse oxc_ast::{AstKind, ast::TSTypeName};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn no_wrapper_object_types(ident_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Do not use wrapper object types.\")\n        .with_note(format!(\n            \"`{ident_name}` is a boxed object type, not a primitive. Boxed types have object semantics (identity/truthiness) that can be surprising. Use `{}` for values, and in `extends`/`implements` use an interface/object shape instead.\",\n            ident_name.cow_to_ascii_lowercase()\n        ))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoWrapperObjectTypes;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow the use of wrapper object types.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Wrapper object types are types that are defined in the global scope and are not primitive types. These types are not recommended to be used in TypeScript code.","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/no_wrapper_object_types.rs#L1-L28","documentation":"Raised by typescript/no-wrapper-object-types when a boxed wrapper type (Number, String, Boolean, Object, Symbol, BigInt) is used where a primitive type is expected. Boxed types have object semantics that cause surprising truthiness and identity behavior.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/typescript/no_wrapper_object_types.rs:10 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the lowercase primitive type (number, string, boolean).","In extends/implements positions, use an interface or object type as suggested in the note."],"exampleFix":null,"handlingStrategy":"validation","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"}