Skip to content

Conversation

@glensc
Copy link
Contributor

@glensc glensc commented Mar 18, 2022

Requires commander update first:

@glensc glensc self-assigned this Mar 18, 2022
@glensc glensc mentioned this pull request Mar 18, 2022
@glensc glensc force-pushed the update-@types/node branch from 7737496 to cc3a7b8 Compare March 18, 2022 08:15
@glensc
Copy link
Contributor Author

glensc commented Mar 18, 2022

Resolving this error:

source/platforms/github/GitHubUtils.ts:92:22 - error TS2769: No overload matches this call.
  Overload 1 of 4, '(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number | undefined, length?: number | undefined): Buffer', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>'.
  Overload 2 of 4, '(str: WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: "string"): string; }, encoding?: BufferEncoding | undefined): Buffer', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'BufferEncoding | undefined'.

92       const buffer = Buffer.from(response.data.content, response.data.encoding)
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any ideas what the encoding parameter would be here:

perhaps the value is always 'base64' there? as I would drop it and use the default?

@fbartho
Copy link
Member

fbartho commented Mar 18, 2022

@glensc what you could do is add a parser that converts “string” to BufferEncoding

const knownBufferEncodings = [“base64”, TODO]
function verifyEncodingOrThrow(encoding: string): BufferEncoding {
  if (knownBufferEncodings.includes(encoding)) {
    return encoding as BufferEncoding
  }
  throw new Error(`Unsupported response buffer encoding ‘${encoding})
}
// Typed in Github, so not tested!

@fbartho
Copy link
Member

fbartho commented Oct 7, 2025

Closing this PR as we're on 18 at this point. Thank you for contributing

@fbartho fbartho closed this Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants