Merge branch 'basic-auth-return-value' of https://github.com/michael42/DefinitelyTyped into michael42-basic-auth-return-value

This commit is contained in:
Andy Hanson
2017-06-02 06:34:38 -07:00
4 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,12 @@
import {IncomingMessage} from 'http';
import auth = require('basic-auth');
auth(null);
const loginData = auth(undefined! as IncomingMessage);
if (loginData) {
const {name, pass} = loginData;
}
auth.parse('Basic QmFzaWM6QXV0aA==');
const parsed = auth.parse('Basic QmFzaWM6QXV0aA==');
if (parsed) {
const {name, pass} = parsed;
}

View File

@@ -1,4 +1,4 @@
// Type definitions for basic-auth v1.1.0
// Type definitions for basic-auth 1.1
// Project: https://github.com/jshttp/basic-auth
// Definitions by: Clément Bourgeois <https://github.com/moonpyk>, Vesa Poikajärvi <https://github.com/vesse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,7 +7,8 @@
import * as http from 'http';
declare function auth(req: http.IncomingMessage): auth.BasicAuthResult;
// See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L49
declare function auth(req: http.IncomingMessage): auth.BasicAuthResult | undefined;
declare namespace auth {
interface BasicAuthResult {

View File

@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }