-
Notifications
You must be signed in to change notification settings - Fork 303
[Typescript] Improve sql() types #85
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
Comments
TLDR workaround: In order to keep
Ok so I'm not the only guilty 😅 microsoft/TypeScript#15300 I tried to get the strongest types I could to prevent unexpected SQL errors at runtime but sometimes they are too strong 😆 I'm working on a fix, what about this one? ( |
@Minigugus can this be closed after merging #84 ? |
@porsager The #84 didn't fixed this since it wasn't clear whether the integration of Node types should have been fixed or dropped (it seems that Do you prefer to drop Node types integration and supports |
Ah, we should definitely just support Uint8Array :) |
Hmm. Switching to Uint8Array is not an option since we can't do allocUnsafe. What's the alternative to fix this issue - adding the dev dependency? |
Why couldn't we do Note: only user-provided buffers matter here; there is no need to convert |
Ah, I misunderstood then. So is this only something that needs fixing in the types? |
Yes, but that may also break the internal code if buffers are expected to extend |
The only place that happens is in the I already wanted to send Would that be sufficient? |
Even so, wouldn't |
Buffer.from(bufferOrUint8Array.buffer, bufferOrUint8Array.byteOffset, bufferOrUint8Array.byteLength)
.tostring('hex') should work, indeed (not tested). The extra parameters ensure the new buffer share the input buffer memory instead of copying it. |
Ah, very cool! Let's go for that now then. |
Do you want to make a PR @Minigugus ? |
Uh oh!
There was an error while loading. Please reload this page.
Looks like that we cannot pass pre defined interface to sql() helper. @Minigugus
Updated
However, it works if you define these type inline or cast it.
The text was updated successfully, but these errors were encountered: