elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.09k stars 193 forks source link

🔧 fix: types in `MaybeEmpty` #696

Open kravetsone opened 1 week ago

kravetsone commented 1 week ago

I remove explicit types and useless any

Nullable: <T extends TSchema>(schema: T) =>
        t.Union([t.Null(), schema]),
    /**
     * Allow Optional, Nullable and Undefined
     */
    MaybeEmpty: <T extends TSchema>(schema: T) =>
        t.Union([t.Null(), t.Undefined(), schema]),

The implementation was lying to us in the types and TNull was missing there

: TUnion<[T, TUndefined]> =>
        t.Union([t.Null(), t.Undefined(), schema]) as any,

Until @SaltyAom merge this, you can use the bun patch