Open risalfajar opened 1 year ago
Doesn't SetOptional does what you need?
It doesn't, optional is different than null
I have used this for now, in case it would be useful for someone:
import { Simplify, Except } from "type-fest";
type SetNullable<BaseType, Keys extends keyof BaseType> =
Simplify<
Except<BaseType, Keys> &
{
[K in Keys]: BaseType[K] | null;
}
>;
@Zaporozhec7 Would you please create a PR to add this to the library?
@Zaporozhec7 Would you please create a PR to add this to the library?
I think it better to wait first for some maintainer opinion on the addition of such a type, or PR may be just rejected
Can we get SetNullable as the opposite of SetNonNullable?
Upvote & Fund