---
url: /docs/guide/usage/linter/rules/typescript/no-invalid-void-type.md
---

### What it does

Disallow `void` type usage outside return types and configured generic contexts.

### Why is this bad?

In TypeScript, `void` is primarily meaningful in return positions. Using `void` in other
type locations (parameters, properties, aliases, and most unions) is usually confusing and
often indicates a mistaken type design.

### Examples

Examples of **incorrect** code for this rule:

```ts
function takeVoid(arg: void) {}
type Alias = void;
type Union = string | void;
```

Examples of **correct** code for this rule:

```ts
function f(): void {}
type P = Promise<void>;
type U = void | never;
```

## Configuration

This rule accepts a configuration object with the following properties:

### allowAsThisParameter

type: `boolean`

default: `false`

Whether a `this` parameter of a function may be `void`.

### allowInGenericTypeArguments

type: `array | boolean`

#### allowInGenericTypeArguments\[n]

type: `string`

## How to use

## Version

This rule was added in v1.47.0.

## References
