type DependencyBase = { binary: string; packageName?: string; }; type DependencyCustom = DependencyBase & { custom: true; install: () => Promise; uninstall: () => Promise; }; export type Dependency = DependencyBase | DependencyCustom; export const isDependencyCustom = ( dependency: Dependency, ): dependency is DependencyCustom => 'custom' in dependency;