@axinom/mosaic-ui
Version:
UI components for building Axinom Mosaic applications
26 lines (25 loc) • 574 B
text/typescript
/**
* Creates a new type with the same properties as `Type`,
* but with all property values set to `undefined` and optional.
* @template Type - The type to negate.
*
* @example
* ```ts
interface Person {
name: string;
age: number;
email: string;
}
type EmptyPerson = Not<Person>;
const emptyPerson: EmptyPerson = {};
// The EmptyPerson type will be equivalent to:
{
name?: undefined;
age?: undefined;
email?: undefined,
}
* ```
*/
export type Not<Type> = {
[Property in keyof Type]?: undefined;
};