-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 1.8.10
Code
declare function compose<A, B, R>(f1: (b: B) => R, f2: (a: A) => B): (a: A) => R;
declare function compose<R>(...funcs: Function[]): (arg: any) => R;
type Creator<S> = () => S;
type Enhancer = <S>(creator: Creator<S>) => Creator<S>;
declare const enhancer1: Enhancer;
declare const enhancer2: Enhancer;
const enhancer = compose(enhancer1, enhancer2);
const creator = enhancer(() => '');
creator();
Expected behavior:
Should compile with no error.
Actual behavior:
Compiler gives error on the last line:
Uncaught Semantic: Cannot invoke an expression whose type lacks a call signature.
However if we remove the second oveload of compose
, everything works fine, which means that the first overload actually matches but for some reason the second one is selected.
Also, if we remove type variable from Enhancer
definition and replace it with string
, it compiles again.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created