link2aws / link2aws.github.io

Get AWS console link from ARN
https://link2aws.github.io/
36 stars 20 forks source link

FEATURE REQUEST: Typescript typings #28

Closed kpeters-cbsi closed 2 years ago

kpeters-cbsi commented 2 years ago

I'd like to use this inside of a Typescript project, but I need typings for same. I tried making my own with dts-gen, but I don't think I did it right, because I'm getting the error:

TypeError: (new link2aws__WEBPACK_IMPORTED_MODULE_1__.ARN(...)).consoleLink is not a function

Here's what I have so far:

// Type definitions for link2aws
// Project: https://github.com/link2aws/link2aws.github.io#readme
// Definitions by: Christopher Peters <https://github.com/kpeters-cbsi/>
/** Declaration file generated by dts-gen */

declare module 'link2aws' {
  class ARN {
    constructor(text: string);
    string(): string;
    console(): string;
    qualifiers(): string[];
    pathLast(): string;
    consoleLink(): string;
  }
}
kpeters-cbsi commented 2 years ago

I got it fixed. The getters were throwing me off.

// Type definitions for link2aws
// Project: https://github.com/link2aws/link2aws.github.io#readme
// Definitions by: Christopher Peters <https://github.com/popefelix>

declare module 'link2aws' {
  class ARN {
    constructor(text: string);
    public string: string;
    public console: string;
    public qualifiers: string[];
    public pathLast: string;
    public consoleLink: string;
  }
}