kyndryl-open-source/hashi-vault-js

Vault.d.ts:1087:2 - error TS2666: Exports and export assignments are not permitted in module augmentations.

Closed this issue · 4 comments

Describe the bug
I try to use this lib in typescript but I got this error:

> rimraf dist && tsc -p tsconfig-build.json

node_modules/hashi-vault-js/Vault.d.ts:1087:2 - error TS2666: Exports and export assignments are not permitted in module augmentations.

1087  export = Vault;
      ~~~~~~


Found 1 error in node_modules/hashi-vault-js/Vault.d.ts:1087

I find the reason: https://github.com/rod4n4m1/hashi-vault-js/blob/62c30e41dd3b6f4eeab3bd07d8d2bc58718e238f/Vault.d.ts#L1087

Should be export default class Vault {/.../}

export = cannot inside declare module.

@phr3nzy

And I think declare module "hashi-vault-js" can be removed:

// declare module "hashi-vault-js" {
  export default class Vault {
  //...
  }
//}

Folks, instead of re-coding all the interfaces, I just used the TypeScript compiler to generate the .d.ts files from the JavaScript code through JSDoc syntax.
https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
Please check if that's good enough!

Closing it due to the age and lack of feedback.