shippo-node-client icon indicating copy to clipboard operation
shippo-node-client copied to clipboard

Property 'carrieraccount' does not exist on type 'Shippo'

Open ohabash opened this issue 2 years ago • 2 comments

I am having trouble reaching carrieraccount. Ive notice several situations where @types might be out-of-date?

import * as shippoClient from 'shippo';
shippoClient('**').carrieraccount;

results in the following error

Property 'carrieraccount' does not exist on type 'Shippo'.

"@types/shippo": "^1.5.1",
"shippo": "^1.7.1",

ohabash avatar Feb 22 '22 19:02 ohabash

Hi @ohabash, You are using an open source library called @types/shippo that is not owned nor maintained by Shippo. The open source library you are using is not extensive nor does it cover all types in shippo including carrieraccount. The current types supported by this open source library can be found here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/shippo/index.d.ts

Unfortunately, Shippo does not have Typescript support for our Node.js library at this time. You can use the JavaScript examples in our API docs here - https://goshippo.com/docs/reference/js#carrier-accounts

Example usage:

const shippo = require('shippo')('<YOUR_PRIVATE_KEY>')

// EXAMPLE | Create carrier account
shippo.carrieraccount.create({
    "carrier":"fedex", 
    "account_id":"<YOUR_FEDEX_ACCOUNT_NUMBER>", 
    "parameters":{"meter":"<YOUR_FEDEX_METER_NUMBER>"},
    "test":true,
    "active":true
}, function(err, account) {
  // asynchronously called
});

// EXAMPLE | Retrieve carrier account
shippo.carrieraccount.retrieve('<OBJECT_ID_OF_CARRIER_ACCOUNT>')

bobbyhalljr avatar Feb 25 '22 15:02 bobbyhalljr

Unfortunately those types are missing Transaction which is imperative for creating a label ☹️ @bobbyhalljr

peterb0yd avatar Apr 28 '22 00:04 peterb0yd