gocardless-nodejs icon indicating copy to clipboard operation
gocardless-nodejs copied to clipboard

Typescript definitions for core client?

Open sekhavati opened this issue 3 years ago • 1 comments

Hello 👋 When using this module as per the readme instructions, we don't get type definitions for the core client object. It comes back as any type. This then has repercussions for the rest of its usage throughout an app. For example:

const gocardless = require('gocardless-nodejs');

const client = gocardless(...); // ==> client is of type 'any'

const mandate = await client.mandates.find(mandateId); // ==> mandate is of type 'any'

etc etc

Perhaps I've missed something blatantly obvious...?

sekhavati avatar Jun 10 '22 13:06 sekhavati

@sekhavati

You can use it like this to get typings:

import { Environments } from "gocardless-nodejs/constants";
import { GoCardlessClient } from "gocardless-nodejs/client";
const client = new GoCardlessClient("your_access_token_here", Environments.Sandbox);

The way defined in the docs seems broken.

mauricedoepke avatar Dec 09 '22 20:12 mauricedoepke