ciscoheat
ciscoheat
Explore posts from servers
Aarktype
Created by ciscoheat on 4/28/2025 in #questions
Add property to object based on its data
It's so cool that Arktype turns into a most convenient and robust CSV->JSON parser ☺️
5 replies
Aarktype
Created by ciscoheat on 4/28/2025 in #questions
Add property to object based on its data
Oh that's nice, thanks
5 replies
Aarktype
Created by ciscoheat on 4/28/2025 in #questions
Add property to object based on its data
I handled it like this:
const product = type("Record<string, unknown>").pipe(r => {
// Parse properties of r, create attributes
r.attributes = ...;
return r;
}).to({
id: "string",
attributes: type({
"[string]": type({
name: "string",
value: "string"
}),
})
})
const product = type("Record<string, unknown>").pipe(r => {
// Parse properties of r, create attributes
r.attributes = ...;
return r;
}).to({
id: "string",
attributes: type({
"[string]": type({
name: "string",
value: "string"
}),
})
})
5 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
Looking forward to that one!
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
Ohh, great
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
Yeah, I'd love to use the JSON Schema feature to improve the adapter for Superforms
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
Just started up a Deno project and used Arktype for CSV -> object validation, so incredibly convenient. Thank you again ☺️
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
Makes sense, thank you!
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
That works, but I'd like to be able, if possible, to use a type directly so it can be easily chained to existing types
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
It could be solved in the pipe function, but it would be nice to just be able to add an empty string type to another type, to avoid rewriting functions.
16 replies
Aarktype
Created by ciscoheat on 4/8/2025 in #questions
Empty string or number
I also have a currency type that I may want to apply the same logic to:
type("string | number").pipe((s) => currency(s))
type("string | number").pipe((s) => currency(s))
But same problem there.
16 replies
DDeno
Created by ciscoheat on 4/7/2025 in #help
When to use deno add compared to import with a prefix?
Ok, thank you!
3 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
That's some very cool introspection
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
That would be nice, then I can determine if it's a primitive js type
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
It works for me as well like that, but in value.expression it's Out<unknown>
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
Thanks for helping out on a saturday ☺️
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
Just found a thing, I have a "nullNumber" validator:
type('number').pipe((n) => (isNaN(n) ? null : n));
type('number').pipe((n) => (isNaN(n) ? null : n));
But when I look at value.expression for that, it looks like: '(In: number) => Out<unknown>' So I assume you cannot easily infer the type (at least not in the expression?) for pipe? If I use infer on the schema, I see that it's null | number at least.
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
I'll take a look at that, thanks!
29 replies
Aarktype
Created by ciscoheat on 3/8/2025 in #questions
Get keys of object type
props looks very good, I have a rather simple, non-nested object type so I'm looking for how to map the property types to a few of the primitive javascript types (string, number, boolean)
29 replies
DTDrizzle Team
Created by ciscoheat on 2/8/2025 in #help
Is it possible to seed nested referenced entities?
I see that all tables are automatically seeded and references, even those not mentioned in the refine callback.
2 replies