Closed jaska120 closed 1 month ago
Hi @jaska120, I'm sorry for the delayed response. One way to achieve this is to extend the predefined interface with a custom one. I’m sharing an example below for your reference.
import { _customer } from "chargebee-typescript";
import { filter } from "chargebee-typescript/lib/filter";
interface customCustomerListParams extends _customer.customer_list_params {
string_0?: filter._string;
}
const response = await chargebeeInstance.customer
.list(<customCustomerListParams>{ string_0: { is: "abc" } })
.request();
Please let me know if this helps.
Hi @jaska120, I'm closing this for now. Please feel free to reopen if required. Thanks.
Wodka's great work has been merged https://github.com/chargebee/chargebee-typescript/pull/23 and the productivity is much better now that we have typings in all the responses.
How would one proceed forward to add typings for custom fields? It is easy to override the return type per call level, but in ideal solution one would write type definitions eg. in
types/chargebee.d.ts
file and instruct tsconfig to look for the locally written types.Could you please provide an example how eg. Customer & Subscription models' type definitions could be extended locally to augment custom field definitions to all the function calls in a single place?