# @typescript-eslint/no-wrapper-object-types

> Disallow `String`, `Number`, `Boolean`, `BigInt`, `Symbol`, and `Object` as types

The type `Number` isn't the type of `1`. It describes the wrapper object that `new Number(1)` creates. A `number` fits into a `Number`, but not the other way around, so you can't pass a value typed `Number` to a function that takes a `number`. The same goes for `String`, `Boolean`, `BigInt`, and `Symbol`.

`Object` accepts almost every value, including strings and numbers. If you mean "not a primitive", use `object`.

`--fix` replaces the type with the lower-case one.

This rule is on by default in TypeScript files.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

On by default as a warning. To turn it off:

```toml bunfig.toml
[lint.rules]
"@typescript-eslint/no-wrapper-object-types" = "off" # or "error"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 3} */}
```ts
function repeat(text: String, times: Number): String {
  return text.repeat(times.valueOf());
}
```

{/* bad */}
```ts
function keysOf(record: Object) {
  return Object.keys(record);
}
```

Not reported:

{/* good */}
```ts
function repeat(text: string, times: number): string {
  return text.repeat(times);
}

function keysOf(record: object) {
  return Object.keys(record);
}
```

Only types are checked. Calling the functions with the same names is fine:

{/* good */}
```ts
const port = Number("3000");
const label = String(port);
```
