From 4820191c9e7f94c450445c0d7bd8900f8a7be6b7 Mon Sep 17 00:00:00 2001 From: Eric Heikes Date: Thu, 15 Feb 2018 10:27:14 -0800 Subject: [PATCH] Rewrite module function declaration & export to match template Follows template in TS docs now: https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html Also makes it possible to reference interfaces from the NodeVault namespace outside of this module. --- types/node-vault/index.d.ts | 6 ++---- types/node-vault/node-vault-tests.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/types/node-vault/index.d.ts b/types/node-vault/index.d.ts index 653db37e85..835e364ae7 100644 --- a/types/node-vault/index.d.ts +++ b/types/node-vault/index.d.ts @@ -122,7 +122,5 @@ declare namespace NodeVault { } } -type GetClient = (options?: NodeVault.VaultOptions) => NodeVault.client; - -declare const getClient: GetClient; -export = getClient; +declare function NodeVault(options?: NodeVault.VaultOptions): NodeVault.client; +export = NodeVault; diff --git a/types/node-vault/node-vault-tests.ts b/types/node-vault/node-vault-tests.ts index 6ce23bd4cd..506514cc92 100644 --- a/types/node-vault/node-vault-tests.ts +++ b/types/node-vault/node-vault-tests.ts @@ -1,7 +1,7 @@ import nv = require("node-vault"); // Test code came from the sample code in README of the module. -const options = { +const options: nv.VaultOptions = { apiVersion: 'v1', // default endpoint: 'http://127.0.0.1:8200', // default token: '1234', // optional client token; can be fetched after valid initialization of the server