Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug ?] broken types for gocardless-nodejs/webhooks #110

Closed
dpr-dev opened this issue Nov 25, 2021 · 3 comments
Closed

[bug ?] broken types for gocardless-nodejs/webhooks #110

dpr-dev opened this issue Nov 25, 2021 · 3 comments

Comments

@dpr-dev
Copy link

dpr-dev commented Nov 25, 2021

Hi there. I'm trying to build integration with gocardless and validate a webhook signature with parse function form the import { parse } from 'gocardless-nodejs/webhooks'. But my linter doesn't see webhook.d.ts and fails with error File '/...path/node_modules/gocardless-nodejs/webhooks.d.ts' is not a module.

How can I include types from the webhook.d.ts ?

Stack:

  • serverless
  • typescript

Tsconfig

{
  "compilerOptions": {
    "sourceMap": true,
    "target": "es2020",
    "lib": ["es2020"],
    "strict": true,
    "noUnusedLocals": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "typeRoots": ["./node_modules/@types", "./src/types"],
    "outDir": "dist"
  }
}

@sebastien-lb
Copy link

sebastien-lb commented Jan 5, 2022

I think this is because module.exports = {} is used instead of export { ... } in the webhook.ts file. I drafted this PR: #111 and confirmed that the created webhook.d.ts file contains the appropriate export instruction.

A quick fix is to declare the module yourself to be able to import it.
declare module "gocardless-nodejs/webhooks" more on that here: https://stackoverflow.com/questions/44058101/typescript-declare-third-party-modules

@sambegin
Copy link

sambegin commented Feb 3, 2022

A lot is broken and the typescript setup feels weird in this project.
Trying to improve it bit by bit: #114

don't know where it will go. This lib doesn't seem to have a lot of activity 🤷

@szastupov szastupov mentioned this issue May 3, 2022
@szastupov
Copy link
Contributor

Sorry for the lack of activity, everyone. This should be fixed in #122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants