Skip to content
New issue

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

Update @types/node to ^14 #1259

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

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
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!

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.

None yet

2 participants