#shapeshift's default with respect to surroundings

1 messages · Page 1 of 1 (latest)

static salmon
#
s.object({
  name: s.enum("A", "B"),
  other: s.object({ name: s.string }).default(/** if name is "A", default is { name: "abc" }, if name is "B", default is { name: "cba" }
tender pikeBOT
#

@static salmon to help others find answers, you can mark your question as solved via Right Click Solution Message->Apps->✅ Mark Solution

acoustic pulsar
#
s.object({
  name: s.enum("A", "B"),
  other: s.object({ name: s.string }).default(/** if name is "A", default is { name: "abc" }, if name is "B", default is { name: "cba" }

With actual code block

static salmon
#

oh wait yea sorry

#

also can I make a recursive shape

acoustic pulsar
#

@ionic elbow might be able to answer quicker than me or @void sand

void sand
#

I don't think this is possible now it will be possible after adding when

ionic elbow
#

I don't fully understand the question

static salmon
ionic elbow
#

Oh, conditional defaults

void sand
static salmon
#

and the recursive object thing, what I mean is

const v = s.object({
  name: "abc",
  option: v
});
ionic elbow
#

Iirc we do support recursivity

void sand
#

yeah

static salmon
ionic elbow
#

It should work

#

I don't remember exactly how to do it

void sand
static salmon
#

oki, thanks