# UnofficialStatusCode

**Kind:** Type

**Source:** [`src/utils/http-status.ts`](https://github.com/honojs/hono/blob/main/src/utils/http-status.ts#L52)

**Part of:** [Utils](subsystem-src-utils)

`UnofficialStatusCode` can be used to specify an unofficial status code.

`UnofficialStatusCode` represents HTTP status codes that are not part of the standard status-code set. Use it when an API response or error path needs to declare an unofficial HTTP status value with type checking.

## Definition

```ts
-1
```

## Diagram

```mermaid
graph LR
  Application[Application code] --> Status[UnofficialStatusCode]
  Status --> Response[HTTP response status]
```

## Usage

```ts
import type { UnofficialStatusCode } from './utils/http-status';

type ErrorResponse = {
  statusCode: UnofficialStatusCode;
  message: string;
};

const response: ErrorResponse = {
  statusCode: 419,
  message: 'Session expired',
};
```

## AI Coding Instructions

- Use `UnofficialStatusCode` for response paths that return a supported unofficial HTTP status value.
- Keep standard HTTP status codes typed through the corresponding standard status-code type.
- Do not cast arbitrary numbers to `UnofficialStatusCode`; add a value only when it belongs in the type definition.
- Preserve the type when passing status codes through response helpers and error handlers.
