Move types into a namespace

This commit is contained in:
Leko 2018-12-07 11:35:23 +09:00
parent 951ef11442
commit e8127e09df
2 changed files with 39 additions and 33 deletions

View File

@ -1,4 +1,6 @@
import ghauth, { AuthOptions, TokenData } from "ghauth";
/// <reference types="node" />
import ghauth = require("ghauth");
import { AuthOptions, TokenData } from "ghauth";
// Full
const authOptions1: AuthOptions = {

View File

@ -3,43 +3,47 @@
// Definitions by: Leko <https://github.com/Leko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface AuthOptions {
configName: string;
declare function ghauth(authOptions: ghauth.AuthOptions, callback: (err: Error, tokenData: ghauth.TokenData) => void): void;
/**
* @default false
*/
noSave?: boolean;
declare namespace ghauth {
interface AuthOptions {
configName: string;
/**
* @default "https://api.github.com/authorizations"
*/
authUrl?: string;
/**
* @default false
*/
noSave?: boolean;
/**
* @default "GitHub"
*/
promptName?: string;
/**
* @default "https://api.github.com/authorizations"
*/
authUrl?: string;
/**
* @default []
*/
scopes?: ReadonlyArray<string>;
/**
* @default "GitHub"
*/
promptName?: string;
/**
* @default "Node.js command-line app with ghauth"
*/
note?: string;
/**
* @default []
*/
scopes?: ReadonlyArray<string>;
/**
* @default "Magic Node.js application that does magic things with ghauth"
*/
userAgent?: string;
/**
* @default "Node.js command-line app with ghauth"
*/
note?: string;
/**
* @default "Magic Node.js application that does magic things with ghauth"
*/
userAgent?: string;
}
interface TokenData {
user: string;
token: string;
}
}
export interface TokenData {
user: string;
token: string;
}
export default function ghauth(authOptions: AuthOptions, callback: (err: Error, tokenData: TokenData) => void): void;
export = ghauth;