Fix up Request.authInfo/user declarations in Passport (#37381)

* Fix up Request.authInfo/user declarations in Passport

* Add myself

* Use no-empty-interface locally
This commit is contained in:
Oleg Vaskevich 2019-08-22 08:16:25 -07:00 committed by Sheetal Nandi
parent b8183c0147
commit 91c229dbdb
2 changed files with 13 additions and 6 deletions

View File

@ -6,20 +6,26 @@
// Tomek Łaziuk <https://github.com/tlaziuk>
// Daniel Perez Alvarez <https://github.com/danielpa9708>
// Kevin Stiehl <https://github.com/kstiehl>
// Oleg Vaskevich <https://github.com/vaskevich>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare global {
namespace Express {
// tslint:disable-next-line:no-empty-interface
interface AuthInfo {}
// tslint:disable-next-line:no-empty-interface
interface User {}
interface Request {
authInfo?: any;
user?: any;
authInfo?: AuthInfo;
user?: User;
// These declarations are merged into express's Request type
login(user: any, done: (err: any) => void): void;
login(user: any, options: any, done: (err: any) => void): void;
logIn(user: any, done: (err: any) => void): void;
logIn(user: any, options: any, done: (err: any) => void): void;
login(user: User, done: (err: any) => void): void;
login(user: User, options: any, done: (err: any) => void): void;
logIn(user: User, done: (err: any) => void): void;
logIn(user: User, options: any, done: (err: any) => void): void;
logout(): void;
logOut(): void;

View File

@ -150,6 +150,7 @@ declare global {
namespace Express {
interface User {
username: string;
id?: string;
}
}
}