Type Alias DurationBySelection<SelectedUnits>

DurationBySelection: undefined extends SelectedUnits
    ? AllDurations
    : {
        [Unit in keyof AllDurations as Unit extends keyof SelectedUnits
            ? SelectedUnits[Unit] extends true ? Unit : never
            : never]: AllDurations[Unit]
    }

Pick a subset of Duration keys by a DurationUnitSelection input.

Type Parameters

import {type DurationBySelection} from 'date-vir';

type MySelection = DurationBySelection<{days: true; months: true}>; // `{days: number, months: number}`