ImpliedAuthField<T>: T extends Authorization<infer _Strat, infer Field, infer isMulti>
    ? Field extends undefined
        ? never
        : Field extends string
            ? isMulti extends true
                ? {
                    [K in Field]?: string[] | null
                }
                : {
                    [K in Field]?: string | null
                }
            : never
    : never

Turns the type from a list of Authorization rules like this:

[
allow.public(),
allow.ownerDefinedIn('otherfield'),
allow.ownersDefinedIn('editors')
]

Into a union of the possible fieldname: type auth objects like this:

{
owner?: string | undefined;
} | {
otherfield?: string | undefined;
} | {
editors?: string[] | undefined;
}

Type Parameters