// @ts-ignore - Only used in doc comments import type { Omit } from "./Omit"; // @ts-ignore - Only used in doc comments import type OmitFn from "./Omit"; import type { Args, GenericFn, GenericResolver } from "../HKT"; import type { Eq, IsPropertyKeyLiteral } from "../helpers"; /** * Less strict version of {@link Omit}.The **W** suffix (short for **W**idening) means that the key * type is widened to `PropertyKey`. * * Sig: `(k: PropertyKey, o: object) => object` */ // We do not use the built-in `Omit` type because it does not keep the readonly modifier. export type OmitW = { [P in keyof O as P extends K ? never : P]: O[P]; }; interface Resolver extends GenericResolver<[PropertyKey, object], object> { on1_: ([k]: Args) => [[object], object]; on_1: ([, o]: Args) => [[PropertyKey], object]; on11: ([k, o]: Args) => [ [], IsPropertyKeyLiteral extends true ? { [P in keyof typeof o as P extends typeof k ? never : P]: (typeof o)[P] } extends infer R ? Eq extends true ? typeof o : R : never : object, ]; } /** * [Fn] Less strict version of {@link OmitFn}.The **W** suffix (short for **W**idening) means that * the key type is widened to `PropertyKey`. * * Sig: `(k: PropertyKey, o: object) => object` */ export default interface OmitWFn extends GenericFn { def: ([k, o]: Args) => { [P in keyof typeof o as P extends typeof k ? never : P]: (typeof o)[P]; }; }