mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Add types for auth-header (#29779)
* Add types for auth-header * Address Feedback
This commit is contained in:
committed by
Sheetal Nandi
parent
da78ffb13c
commit
f46aa0bfb1
@@ -0,0 +1,6 @@
|
||||
import * as auth from 'auth-header';
|
||||
|
||||
const basic: string = auth.format('Basic');
|
||||
const basic2: string = auth.format({scheme: 'Basic'});
|
||||
|
||||
const parsed: {scheme: string, token: null | string | string[]} = auth.parse('');
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for auth-header 1.0
|
||||
// Project: https://github.com/izaakschroeder/auth-header
|
||||
// Definitions by: ForbesLindesay <https://github.com/ForbesLindesay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
type Params =
|
||||
| Array<[string, string | ReadonlyArray<string>]>
|
||||
| {[key: string]: string | ReadonlyArray<string>};
|
||||
export {Params};
|
||||
|
||||
export interface TokenOptions {
|
||||
scheme: string;
|
||||
token?: string;
|
||||
params?: Params;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
scheme: string;
|
||||
params: {[key: string]: string | string[]};
|
||||
token: null | string | string[];
|
||||
}
|
||||
|
||||
export function format(token: TokenOptions): string;
|
||||
export function format(scheme: string, token?: string, params?: Params): string;
|
||||
|
||||
export function parse(header: string): Token;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"auth-header-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user