Skip to content

Commit

Permalink
Improve dataset settings hook typings
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfdsilva committed Sep 22, 2023
1 parent ac17b50 commit 3be9f44
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions app/scripts/components/exploration/atoms/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,13 @@ export function useTimelineDatasetAtom(id: string) {
return datasetAtom as PrimitiveAtom<TimelineDataset>;
}

type Settings = TimelineDataset['settings'];

type TimelineDatasetSettingsReturn = [
(
prop: keyof TimelineDataset['settings']
) => TimelineDataset['settings'][keyof TimelineDataset['settings']],
(
prop: keyof TimelineDataset['settings'],
value:
| TimelineDataset['settings'][keyof TimelineDataset['settings']]
| ((
prev: TimelineDataset['settings'][keyof TimelineDataset['settings']]
) => TimelineDataset['settings'][keyof TimelineDataset['settings']])
<T extends keyof Settings>(prop: T) => Settings[T],
<T extends keyof Settings>(
prop: T,
value: Settings[T] | ((prev: Settings[T]) => Settings[T])
) => void
];

Expand Down

0 comments on commit 3be9f44

Please sign in to comment.