When you have a type with optional props, then to make those props required you can use Required
like so:
type TTypeWithOptional = {
a?: string;
b: string | undefined;
c?: string | null
};
type TRequired = Required<TTypeWithOptional>;
/*
// result
type TRequired = {
a: string;
b: string | undefined;
c: string | null;
}
*/
Code language: TypeScript (typescript)
Continue reading