We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue
I tried to use the Import contacts example from the README in a typescript project:
const file = { data: fs.createReadStream(fileName), name: fileName, }; // [...] const response = await hubspotClient.crm.imports.coreApi.create(file, JSON.stringify(importRequest));
And I get the following type error:
error TS2740: Type 'ReadStream' is missing the following properties from type 'Buffer': write, toJSON, equals, compare, and 97 more.
I think that the HttpFile type definition is incomplete, because in its current state it only expects to receive a Buffer:
HttpFile
Buffer
export type HttpFile = { data: Buffer; name: string; };
But the node-fetch library can accept many types in the request body.
node-fetch
Proposal
I suggest making at least this change:
export type HttpFile = { data: Buffer|ReadableStream; name: string; };
But perhaps to be as complete as possible, the following change would be preferable:
export type HttpFile = { data: Buffer|ReadableStream|ArrayBuffer|ArrayBufferView|string; name: string; };
Workaround:
In the meantime, I use the following (ugly) code, if it can help anyone experiencing the same problem. :
const file = { data: fs.createReadStream(fileName) as any, name: fileName, };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue
I tried to use the Import contacts example from the README in a typescript project:
And I get the following type error:
I think that the
HttpFile
type definition is incomplete, because in its current state it only expects to receive aBuffer
:But the
node-fetch
library can accept many types in the request body.Proposal
I suggest making at least this change:
But perhaps to be as complete as possible, the following change would be preferable:
Workaround:
In the meantime, I use the following (ugly) code, if it can help anyone experiencing the same problem. :
The text was updated successfully, but these errors were encountered: