Here's a case where I need a few existentials. It's for a definition file, where I need to have parameters for Binding and Scheduler, but it doesn't matter to me what they are. All I care about is that they're internally correct (and any doesn't cover this), and I'd rather not simulate it by making the constructor unnecessarily generic.
The alternative for me is to be able to declare additional constructor-specific type parameters that don't carry to other methods, but existentials would make it easier.
exportinterfaceScheduler<Frame,Idle>{nextFrame(func: ()=>any): Frame;cancelFrame(frame: Frame): void;nextIdle(func: ()=>any): Idle;cancelIdle(frame: Idle): void;nextTick(func: ()=>any): void;}exportinterfaceBinding<E>extendsComponent{binding: E;patchEnd?(): void;patchAdd?(prev: string|E|void,next: string|E|void,pos: number,): void;patchRemove?(prev: string|E|void,next: string|E|void,pos: number): void;patchChange?(oldPrev: string|E|void,newPrev: string|E|void,oldNext: string|E|void,newNext: string|E|void,oldPos: number,newPos: number): void;}exportclassSubtree{constructor(onError?: (err: Error)=>any,scheduler?: type<F,I>Scheduler<F,I>);// ...}exportclassRootextendsSubtree{constructor(component: type<E>Binding<E>,onError?: (err: Error)=>any,scheduler?: type<F,I>Scheduler<F,I>);// ...}
Here's a case where I need a few existentials. It's for a definition file, where I need to have parameters for
BindingandScheduler, but it doesn't matter to me what they are. All I care about is that they're internally correct (andanydoesn't cover this), and I'd rather not simulate it by making the constructor unnecessarily generic.The alternative for me is to be able to declare additional constructor-specific type parameters that don't carry to other methods, but existentials would make it easier.