Home > types-kit > SetOptional
Make some properties in T optional.
Signature:
export type SetOptional<T, K extends Keys<T>> = Simplify<
StrictOmit<T, K> & Partial<Pick<T, K>>
>References: Keys, Simplify, StrictOmit
interface Props {
a: number;
b: number;
c: number;
};
// Expect: { a?: number; b?: number; c: number; }
type NewProps = SetOptional<Props, 'a' | 'b'>;