From e8127e09dfdaeaf1f7995f9a5ada2bfdfac936a7 Mon Sep 17 00:00:00 2001 From: Leko Date: Fri, 7 Dec 2018 11:35:23 +0900 Subject: [PATCH] Move types into a namespace --- types/ghauth/ghauth-tests.ts | 4 ++- types/ghauth/index.d.ts | 68 +++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/types/ghauth/ghauth-tests.ts b/types/ghauth/ghauth-tests.ts index 7757cf24dd..56bc0cd1b0 100644 --- a/types/ghauth/ghauth-tests.ts +++ b/types/ghauth/ghauth-tests.ts @@ -1,4 +1,6 @@ -import ghauth, { AuthOptions, TokenData } from "ghauth"; +/// +import ghauth = require("ghauth"); +import { AuthOptions, TokenData } from "ghauth"; // Full const authOptions1: AuthOptions = { diff --git a/types/ghauth/index.d.ts b/types/ghauth/index.d.ts index e21afdf3fa..3d91ab8ef5 100644 --- a/types/ghauth/index.d.ts +++ b/types/ghauth/index.d.ts @@ -3,43 +3,47 @@ // Definitions by: 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; + /** + * @default "GitHub" + */ + promptName?: string; - /** - * @default "Node.js command-line app with ghauth" - */ - note?: string; + /** + * @default [] + */ + scopes?: ReadonlyArray; - /** - * @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;