D
Deno

help

Object to tuple of tuple of keys and type?

OOctal!7/29/2023
Example:
type SomeType = {
owo: string
uwu: number
}
type SomeType = {
owo: string
uwu: number
}
Into
type SomeType = [
["owo", string],
["uwu", number]
]
type SomeType = [
["owo", string],
["uwu", number]
]
AAapoAlas7/29/2023
Object.entries
OOctal!7/30/2023
I wanna do it on the type level Aha I figured it out I converted the object to and object of it's keys to a tuple of the current key and it's type, then converted it to a tuple of it's types
OOctal!7/30/2023
(picture of my screen because I'm waiting on a new router) It's formatted in such a way that a rust serde serialized enum will match the type
OOctal!7/30/2023
{owo: string, uwu: number} -> {owo: ["owo", string], uwu: ["uwu", number]} -> [["owo", string], ["uwu", number]] -> {owo: string, uwu: undefined} | {owo: undefined, uwu: number}

Looking for more? Join the community!

Recommended Posts
typescript compiler (38.24MB) included in bundle when importing google's npm:schema-dtsNot sure if this is a bug, but I couldn't see how the package imports the compiler. create a ts fildebug why a file is importedI get a compilation error from a ts file that shouldn't be imported. How can I debug the import chaiCan I rename my deno.land package?Is it possible? What should I do?Deno Compile in NixOS docker imageI'm trying to compile code to deploy to aws lambda functions. I can do it locally on my m1 mac just Discord User Authentication WebsiteCan anyone help me create a web server that allows users to login to their discord account and then Dynamic interfacesIs it possible to have like an interface that has a type entry and when it is a string for example tDisable / Replace Loading FaviconHaven't found anything regarding it and likely is not possible, however I thought I might as well sDeno test Leaking resourcesHi i currently try to get used to deno.test but Deno.readTextFile makes the test end in the followinDeno.Command arg with an asterisk?I am trying to execute a shell command from Deno, where one of the command args contains an asterisk`deno compile` in Nix results in `deno repl` starting instead of actual programI wrote following Nix impure derivation for my Deno app: ```nix packages.api = pkgs.stdenv.mkDerivat`@sentry/node` is throwing an export error on Deno DeployHello, this is my first time using Deno. I was trying to use the `@sentry/node` client on deploy, basync mapIs there anyway using the stdlib to map from one array to another array, with the work being done coHTTP 206 + HTML5 video streaming with Freshhow do I implement an endpoint to stream a video to a HTML video player using HTTP 206 in Fresh? Herrusty_v8 extracting stack trace when a promise rejectsHi, i am trying to get the stack trace and print it out when a promise rejects. ```rust if promise.s