Help needed with use with Typescript
rickhoro opened this issue · 1 comments
I've gotten this to work with node and typescript with the associated @types/backblaze-b2 package but I have not been able to figure out how to use the interfaces defined in the index.d.ts file in my node js program. For example, I am trying to define a BucketInfo interface that can be used to extract data from a getBucket() call. In the BucketInfo interface, I would like to define a bucketType: BucketType property, but I cannot figure out how to get access to the BucketType type definition in the index.d.ts file in @types/backblaze-b2. Can anyone suggest a solution?
Currently, I am importing the b2 definition like this:
import B2 = require("./node_modules/@types/backblaze-b2");
This allows me to call B2 as a constructor, but I don't seem to be able to use it as a namespace.
I'm not sure if this is appropriate to post as an issue, but it would be helpful to add this to the examples in the doc, so I suppose it is valid.
I'm not sure why you need to use it like this. DefinitelyType (the @type stuff) is purely for Typescript to fetch type definition. When you are importing, you should always import the original package, i.e.
import B2 from "backblaze-b2"