Closed
Description
This is a bit tough to explain but probably similar to: #10014
TypeScript Version: 2.0.6
Code
So if I want to specify (when using strict null checks):
export interface Selector<TSource, TResult>
{
(source:TSource, index?:number):TResult;
}
Which will allow me to use functions that take 1 or 2 parameters where the second one is a number or undefined. But what I really want is that if a second parameter is defined it will be a number.
Any signature style overrides I tried seemed to just screw things up more.
Is there a workaround for this without having to create separate interfaces like:
export interface Selector<TSource, TResult>
{
(source:TSource, index?:number):TResult;
}
export interface SelectorIndexed<TSource, TResult>
{
(source:TSource, index:number):TResult;
}