From 5edbf1e6623bbaadca813d87b6fc1afd335a3cb5 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Mon, 28 Jan 2019 20:18:25 -0500 Subject: [PATCH 1/2] feat(typescript): Add typings for the module --- index.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 000000000..9041ba99a --- /dev/null +++ b/index.d.ts @@ -0,0 +1,25 @@ +import LRU = require("lru-cache"); + +declare interface AppOptions { + id: string + privateKey: string + baseUrl?: string + cache?: LRU.Cache +} +declare interface getJWTOptions { + installation_id: string +} + +declare interface getInstallationAccessTokenOptions { + installation_id: string +} + +// Not really a class, but it is how they say it should be used in the readme. +// In TypeScript, you cannot use the `new` keyword on functions (excluding old-style classes using functions and prototype), only on classes +declare class App { + constructor(options: AppOptions) + getSignedJsonWebToken(options?: getJWTOptions): Promise + getInstallationAccessToken(options?: getInstallationAccessTokenOptions): Promise +} + +export = App; From 4317b3e325551eb531cba42b16589bfa2eb63dd7 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Mon, 28 Jan 2019 20:25:32 -0500 Subject: [PATCH 2/2] getSignedJsonWebToken is not async --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 9041ba99a..9f642b5bb 100644 --- a/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ declare interface getInstallationAccessTokenOptions { // In TypeScript, you cannot use the `new` keyword on functions (excluding old-style classes using functions and prototype), only on classes declare class App { constructor(options: AppOptions) - getSignedJsonWebToken(options?: getJWTOptions): Promise + getSignedJsonWebToken(options?: getJWTOptions): string getInstallationAccessToken(options?: getInstallationAccessTokenOptions): Promise }