Is there a way to declare a generic type GetAppActions
where if T
is equal to trigger
, only the trigger
data property is displayed, and vice versa?
type GetAppActionType = 'trigger' | 'action'
interface AppActionInputField {}
type GetAppActions<T = GetAppActionType> = {
data: {
action: { inputFields: AppActionInputField[] }
trigger: { inputFields: AppActionInputField[] }
}
type: T
}