san
san
Explore posts from servers
CDCloudflare Developers
Created by san on 4/17/2025 in #durable-objects
CVEs
ahh I'm talking about AI agent generated code, thats why I mentioned MCP server
5 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
I somehow came up with this monstrosity which seems to work (and I barely understand how lol):
function deepRequired<o extends type<object>>(
o: o
): type<RecursiveRequired<o["t"]>>;
function deepRequired(o: type<Record<string, unknown> | unknown[]>): unknown {
if (o.extends("Array")) {
return o
.select({
kind: "sequence",
method: "assertFind",
boundary: "shallow",
})
.variadic?.map((prop) =>
prop.value.extends("object")
? ({
...prop,
kind: "required",
value: deepRequired(prop.value as never),
} as never)
: { ...prop, kind: "required" }
)
.array();
}
return o.map((prop) =>
prop.value.extends("object")
? {
...prop,
kind: "required",
value: deepRequired(prop.value as never),
}
: { ...prop, kind: "required" }
);
}
function deepRequired<o extends type<object>>(
o: o
): type<RecursiveRequired<o["t"]>>;
function deepRequired(o: type<Record<string, unknown> | unknown[]>): unknown {
if (o.extends("Array")) {
return o
.select({
kind: "sequence",
method: "assertFind",
boundary: "shallow",
})
.variadic?.map((prop) =>
prop.value.extends("object")
? ({
...prop,
kind: "required",
value: deepRequired(prop.value as never),
} as never)
: { ...prop, kind: "required" }
)
.array();
}
return o.map((prop) =>
prop.value.extends("object")
? {
...prop,
kind: "required",
value: deepRequired(prop.value as never),
}
: { ...prop, kind: "required" }
);
}
10 replies
Aarktype
Created by san on 3/2/2025 in #questions
array of objects?
I take this back. Arktype is a marvel of engineering
7 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
okay scopes is annoying to use for this usecase 💔
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
I think this is a bug
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
im just gonna use scopes
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
tried this solution but seems like it doesnt apply to the elements in arrays? how do I fix that
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
incredible, thank you!
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
what a godsend
10 replies
Aarktype
Created by san on 4/7/2025 in #questions
Is there a way to "deep" require a type?
OH i can use scopes
10 replies
Aarktype
Created by san on 3/2/2025 in #questions
array of objects?
nvm I'll stick to TypeBox, this is somehow way more complicated
7 replies
DTDrizzle Team
Created by san on 2/13/2025 in #help
Is it possible to run migrations on a local dev D1 db?
oh wrangler d1 apply --local works perfectly. nice
2 replies