-
-
Notifications
You must be signed in to change notification settings - Fork 281
Open
Labels
feedbackGeneral feedback that does not result in changesGeneral feedback that does not result in changesquestionFurther information is requestedFurther information is requested
Description
import * as v from 'valibot';
(() => {
let d = v.intersect([v.object({ a: v.number() }), v.optional(v.object({ b: v.number() }))]);
console.log();
type D = v.InferInput<typeof d>;
type DD =
| {
a: number;
}
| ({
a: number;
} & {
b: number;
});
let d0: D = { a: 1 };
let d1: DD = { a: 1 };
})();

I know this question was answered before, {}&({}|undefined)=>{}
However, I suddenly came up with the idea yesterday whether it's possible to implement it according to the above DD type
. Although this approach might not conform to TypeScript's type system design, it aligns with a person's intuitive sense.
I’m not sure if this design aligns with your vision. If you don't have time to implement it, I can also try to implement it (if feasible)
dosubot
Metadata
Metadata
Assignees
Labels
feedbackGeneral feedback that does not result in changesGeneral feedback that does not result in changesquestionFurther information is requestedFurther information is requested