@types/cors
TypeScript definitions for cors
Last updated 3 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ gnpm install @types/cors 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/cors

Summary

This package contains type definitions for cors (https://github.com/expressjs/cors/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors.

index.d.ts

/// <reference types="node" />

import { IncomingHttpHeaders } from "http";

type StaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;

type CustomOrigin = (
    requestOrigin: string | undefined,
    callback: (err: Error | null, origin?: StaticOrigin) => void,
) => void;

declare namespace e {
    interface CorsRequest {
        method?: string | undefined;
        headers: IncomingHttpHeaders;
    }
    interface CorsOptions {
        /**
         * @default '*''
         */
        origin?: StaticOrigin | CustomOrigin | undefined;
        /**
         * @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
         */
        methods?: string | string[] | undefined;
        allowedHeaders?: string | string[] | undefined;
        exposedHeaders?: string | string[] | undefined;
        credentials?: boolean | undefined;
        maxAge?: number | undefined;
        /**
         * @default false
         */
        preflightContinue?: boolean | undefined;
        /**
         * @default 204
         */
        optionsSuccessStatus?: number | undefined;
    }
    type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
        req: T,
        callback: (err: Error | null, options?: CorsOptions) => void,
    ) => void;
}

declare function e<T extends e.CorsRequest = e.CorsRequest>(
    options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
): (
    req: T,
    res: {
        statusCode?: number | undefined;
        setHeader(key: string, value: string): any;
        end(): any;
    },
    next: (err?: any) => any,
) => void;
export = e;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Alan Plum, and Gaurav Sharma.

Current Tags

  • 2.8.17                                ...           latest (a year ago)
  • 2.8.1                                ...           ts2.0 (8 years ago)
  • 2.8.1                                ...           ts2.1 (8 years ago)
  • 2.8.5                                ...           ts2.2 (6 years ago)
  • 2.8.6                                ...           ts2.3 (5 years ago)
  • 2.8.6                                ...           ts2.4 (5 years ago)
  • 2.8.6                                ...           ts2.5 (5 years ago)
  • 2.8.6                                ...           ts2.6 (5 years ago)
  • 2.8.6                                ...           ts2.7 (5 years ago)
  • 2.8.6                                ...           ts2.8 (5 years ago)
  • 2.8.6                                ...           ts2.9 (5 years ago)
  • 2.8.7                                ...           ts3.0 (4 years ago)
  • 2.8.7                                ...           ts3.1 (4 years ago)
  • 2.8.8                                ...           ts3.2 (4 years ago)
  • 2.8.9                                ...           ts3.3 (4 years ago)
  • 2.8.10                                ...           ts3.4 (4 years ago)
  • 2.8.10                                ...           ts3.5 (4 years ago)
  • 2.8.12                                ...           ts3.6 (3 years ago)
  • 2.8.12                                ...           ts3.7 (3 years ago)
  • 2.8.12                                ...           ts3.8 (3 years ago)
  • 2.8.12                                ...           ts3.9 (3 years ago)
  • 2.8.12                                ...           ts4.0 (3 years ago)
  • 2.8.12                                ...           ts4.1 (3 years ago)
  • 2.8.13                                ...           ts4.2 (2 years ago)
  • 2.8.14                                ...           ts4.3 (a year ago)
  • 2.8.14                                ...           ts4.4 (a year ago)
  • 2.8.17                                ...           ts4.5 (a year ago)
  • 2.8.17                                ...           ts4.6 (a year ago)
  • 2.8.17                                ...           ts4.7 (a year ago)
  • 2.8.17                                ...           ts4.8 (a year ago)
  • 2.8.17                                ...           ts4.9 (a year ago)
  • 2.8.17                                ...           ts5.0 (a year ago)
  • 2.8.17                                ...           ts5.1 (a year ago)
  • 2.8.17                                ...           ts5.2 (a year ago)
  • 2.8.17                                ...           ts5.3 (a year ago)
  • 2.8.17                                ...           ts5.4 (a year ago)

32 Versions

  • 2.8.17                                ...           a year ago
  • 2.8.16                                ...           a year ago
  • 2.8.15                                ...           a year ago
  • 2.8.14                                ...           a year ago
  • 2.8.13                                ...           2 years ago
  • 2.8.12                                ...           3 years ago
  • 2.8.11                                ...           3 years ago
  • 2.8.10                                ...           4 years ago
  • 2.8.9                                ...           4 years ago
  • 2.8.8                                ...           4 years ago
  • 2.8.7                                ...           4 years ago
  • 2.8.6                                ...           5 years ago
  • 2.8.5                                ...           6 years ago
  • 2.8.4                                ...           7 years ago
  • 2.8.3                                ...           7 years ago
  • 2.8.2                                ...           7 years ago
  • 2.8.1                                ...           8 years ago
  • 2.8.0                                ...           8 years ago
  • 0.0.33                                ...           8 years ago
  • 0.0.32                                ...           8 years ago
  • 0.0.31                                ...           8 years ago
  • 0.0.30                                ...           8 years ago
  • 0.0.29                                ...           8 years ago
  • 0.0.28-alpha                                ...           8 years ago
  • 0.0.27-alpha                                ...           8 years ago
  • 0.0.26-alpha                                ...           8 years ago
  • 0.0.25-alpha                                ...           8 years ago
  • 0.0.24-alpha                                ...           8 years ago
  • 0.0.23-alpha                                ...           9 years ago
  • 0.0.22-alpha                                ...           9 years ago
  • 0.0.17-alpha                                ...           9 years ago
  • 0.0.16-alpha                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |