/** * Type helper ที่แอปใช้ตอนห่อ component ของแพ็กเกจ — ไม่มีโค้ดตอนรัน */ /** * `Omit` ที่ทำทีละสมาชิกของ union — props ของ component ที่มี `mode`/variant * (เช่น `DatePickerProps` ที่เป็น `DatePickerSingleProps | DatePickerRangeProps`) * ถ้าใช้ `Omit` ปกติจะถูกยุบเป็นก้อนเดียว แยกตาม discriminant ไม่ได้อีก (Pi Auth เจอตอนห่อ `DateField`) * * type DateFieldProps = DistributiveOmit & { label: string }; * // แยกตาม props.mode ได้ตามปกติ ไม่ต้อง cast */ export type DistributiveOmit = T extends unknown ? Omit : never; /** `Pick` ที่ทำทีละสมาชิกของ union (คู่กับ `DistributiveOmit`) */ export type DistributivePick = T extends unknown ? Pick> : never;