@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
15 lines (11 loc) • 485 B
text/typescript
import { DateRangeSelectValue, mapDateRangeSelectValueToDateRange as map } from '@prefecthq/prefect-design'
import { MapFunction } from '@/services/Mapper'
type Source = NonNullable<DateRangeSelectValue>
type Target = NonNullable<ReturnType<typeof map>>
export const mapDateRangeSelectValueToDateRange: MapFunction<Source, Target> = (source) => {
const value = map(source)
if (!value) {
throw new Error('Failed to map date range because value is null')
}
return value
}