import type { LogParams } from '../logger'; import type { Rule } from '../logger.rules'; export type NoUndefinedProperty = { properties: T; property: keyof T; rule?: Rule; }; export const noUndefinedProperty = ({ property, properties, rule = 'NO_UNDEFINED', }: NoUndefinedProperty): LogParams | null => { if (properties?.[property] == null) { return { rule, message: `The property "${property as string}" cannot be UNDEFINED`, extra: properties, }; } return null; };