You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the AccountingApiCustomersAddRequest, the customer field is of type Customer, which has a required id property. The endpoint doesn't actually require an id in the payload, so this field should not be required.
Expected
The following code should compile:
constapideck=newApideck({apiKey: 'REPLACE_WITH_API_KEY',appId: 'REPLACE_WITH_APP_ID',consumerId: 'REPLACE_WITH_CONSUMER_ID'});constparams={customer: {display_id: 'EMP00101',display_name: 'Windsurf Shop',company_name: 'SpaceX',first_name: 'Elon',last_name: 'Musk',// ... other (optional) fields},};try{const{ data }=awaitapideck.accounting.customersAdd(params);console.log('API called successfully',data);}catch(error){console.error(error);}
Actual
The above code fails compilation because id is a required field on customer.
Argument of type '{ customer: { display_id: string; display_name: string; company_name: string; first_name: string; last_name: string; }; }' is not assignable to parameter of type 'AccountingApiCustomersAddRequest'.
Types of property 'customer' are incompatible.
Property 'id' is missing in type '{ display_id: string; display_name: string; company_name: string; first_name: string; last_name: string; }' but required in type 'Customer'.ts(2345)
Customer.d.ts(32, 14): 'id' is declared here.
The text was updated successfully, but these errors were encountered:
Summary
In the
AccountingApiCustomersAddRequest
, thecustomer
field is of typeCustomer
, which has a requiredid
property. The endpoint doesn't actually require an id in the payload, so this field should not be required.Expected
The following code should compile:
Actual
The above code fails compilation because
id
is a required field oncustomer
.The text was updated successfully, but these errors were encountered: