It would be great if unionize could support union of generic variants
I'm using a generic interface in one of my projects to represent generic fetch status
export interface Fetch<T> {
results: T[]
finished: boolean
}
and I want it to become
export interface FetchLoading {
type: 'loading'
}
export interface FetchSuccess<T> {
type: 'success'
results: T[]
finished: boolean
}
export interface FetchSuccessWithErrors<T> {
type: 'successWithErrors'
results: T[]
finished: boolean
errors: string[]
}
export interface FetchError {
type: 'error'
reason: string
}
And I would create an union type which could be consumed by a UI component showing the fetch status according to its type.
How could we achieve that with unionize?
It would be great if unionize could support union of generic variants
I'm using a generic interface in one of my projects to represent generic fetch status
and I want it to become
And I would create an union type which could be consumed by a UI component showing the fetch status according to its type.
How could we achieve that with unionize?