# @types/koa2-cors

> TypeScript definitions for koa2-cors

Latest version **2.0.6** (published 2025-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/koa2-cors
pnpm add @types/koa2-cors
yarn add @types/koa2-cors
bun add @types/koa2-cors
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2025-10-24 |
| First published | 2017-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/koa2-cors
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa2-cors
- npm.io page: https://npm.io/package/@types/koa2-cors

## Dependencies (1)

- [@types/koa](https://npm.io/package/@types/koa.md) *

## Recent versions

- 2.0.6 (latest) — 2025-10-24
- 2.0.5 (ts5.1) — 2023-11-07
- 2.0.2 (ts3.6) — 2021-07-08
- 2.0.1 (ts3.5) — 2017-11-09
- 2.0.0 (ts2.1) — 2017-10-17
- 2.0.4 — 2023-10-18
- 2.0.3 — 2023-09-14

## README

# Installation
> `npm install --save @types/koa2-cors`

# Summary
This package contains type definitions for koa2-cors (https://github.com/zadzbw/koa2-cors#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa2-cors.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa2-cors/index.d.ts)
````ts
import Koa = require("koa");
declare namespace cors {
    interface Options {
        origin?: string | ((ctx: Koa.Context) => boolean | string) | undefined;
        exposeHeaders?: string[] | undefined;
        maxAge?: number | undefined;
        credentials?: boolean | undefined;
        allowMethods?: string[] | undefined;
        allowHeaders?: string[] | undefined;
    }
}

declare function cors(options?: cors.Options): Koa.Middleware;

export = cors;

````

### Additional Details
 * Last updated: Fri, 24 Oct 2025 04:02:41 GMT
 * Dependencies: [@types/koa](https://npmjs.com/package/@types/koa)

# Credits
These definitions were written by [xialeistudio](https://github.com/xialeistudio).

---
_Source: https://npm.io/package/@types/koa2-cors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
