import deleteUndefined from "./deleteUndefined"; type WithoutUndefined = { [prop in keyof T]: T[prop] extends infer U | undefined ? U : T[prop]; }; export default (obj: T): WithoutUndefined => { const without = { ...obj }; deleteUndefined(without); return without as any; };