Airplane
Airplane
CCConvex Community
Created by ballingt on 10/11/2022 in #general
Spread Parameter Question
yep that worked thanks! My use case is a little more complex though so it's still giving me an error - any way to make something like this work?
const c = [s.string(), s.boolean()] as const;

s.union(...c.map((a) => s.object({ keyName: a })));
const c = [s.string(), s.boolean()] as const;

s.union(...c.map((a) => s.object({ keyName: a })));
4 replies
CCConvex Community
Created by Airplane on 10/7/2022 in #general
Schema for Record types
ah I see, that makes sense thanks! Would it also be possible to do
s.union(s.object({
myKey: s.number()
}), s.map(s.string(), s.number())
s.union(s.object({
myKey: s.number()
}), s.map(s.string(), s.number())
to create a combination of required properties but also allow for extra ones? At this point my understanding is that schemas are a typescript-only feature, so would doing something like this actually compute the corresponding types?
6 replies