TypeScript: How to set the data
parameter to Buffer
#2087
-
How must I upload binary release assets using the v17 api? The typings say |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
It looks like the
|
Beta Was this translation helpful? Give feedback.
-
Thanks for opening the issue and the update. Sounds like the typing is off. The code lives at https://github.com/octokit/plugin-rest-endpoint-methods.js/. The types for the endpoint methods are generated here: https://github.com/octokit/plugin-rest-endpoint-methods.js/blob/master/scripts/update-endpoints/types.js The "Upload a release asset" is a special case endpoint. For example, it's the only one with a parameter that can be either To give you a quick run down how these methods are generated:
|
Beta Was this translation helpful? Give feedback.
-
That looks a bit scary. I can confirm though that |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
I'm not sure if we will be able to address this, because Buffer only exists in Node, but the types are used also by code run in Browsers and Deno. We would need to add a manual workaround when generating the types, which might be possible, but I'm unsure at this point. I'm glad the |
Beta Was this translation helpful? Give feedback.
-
I see no activity on this issue since August and there isn't even a warning which is dangerous. We recently upgraded Octokit and this typing mismatch caused a major issue at Sentry: getsentry/craft#302 Anything we an help to expedite a solution, if not a big big warning? |
Beta Was this translation helpful? Give feedback.
It looks like the
data
parameter touploadReleaseAsset
must bestring | Buffer
, notstring
, but I don't know where the code lives so I can't put together a PR. For the time being, this works: