Genshii
Genshii
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
thanks!
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
gotcha, I'll play around with this, I think I'm on the right track
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
Dumb example but are saying that if I do something like this:
const foo = type.module(
{
bar: {
name: "string",
myKey: "number",
},
},
{
domain: {
message: (ctx) => {
console.log(ctx)
return "foo"
},
},
},
)
const foo = type.module(
{
bar: {
name: "string",
myKey: "number",
},
},
{
domain: {
message: (ctx) => {
console.log(ctx)
return "foo"
},
},
},
)
it would show "foo" for every validation failure on bar?
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
well i suppose then i'm back to square one lol, because error handlers only apply shallowly anyway
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
ohh i see, i thought modules defined an object type, but I realize that's not the case at all what I'm really trying to do is this I think:
const foo = type.module({
bar: {
name: "string",
myKey: "number",
},
})
const fooArray = foo.bar.array()
const foo = type.module({
bar: {
name: "string",
myKey: "number",
},
})
const fooArray = foo.bar.array()
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
right, my intention was to then set the error handlers on domain etc for that module
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
or maybe I'm misunderstanding what modules actually are
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
a module doesn't have any of the normal type functions on it, do I need to somehow convert it to a type first?
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
const foo = type.module({
name: "string",
myKey: "number",
})
const fooArray = foo.array()
const foo = type.module({
name: "string",
myKey: "number",
})
const fooArray = foo.array()
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
i thought a module was basically just a type, or at least could be used in he same way
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
uhh sorry, trying to do this with a scope, but running into an issue where .array() doesn't exist on the exported module
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
is there anything in the docs that describe what domain, unit, predicate, etc refer to?
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
ahhhh okay
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
I know I can set an onFail globally or for a scope, but that doesn't have the context I would need
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
Yeah I don't think I even need to use a scope necessarily, it seemed like that was the right direction though
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
Oh gotcha, well in my case I don't think I need to reference the alias at all? I think everything I need is on the error ctx itself (at least for problem/message)
44 replies
Aarktype
Created by Genshii on 2/26/2025 in #questions
Configure errors in a scope
What do you mean by named type?
44 replies
Aarktype
Created by Genshii on 2/25/2025 in #questions
Get ts type that accepts type arguments
Really appreciate you taking the time to help me out
25 replies
Aarktype
Created by Genshii on 2/25/2025 in #questions
Get ts type that accepts type arguments
Makes sense, thanks. it's probably not really necessary like you said
25 replies
Aarktype
Created by Genshii on 2/25/2025 in #questions
Get ts type that accepts type arguments
Which may sound silly or like it's bad design (it might be 😅) but it's the best I have for now
25 replies