-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 2.0.3 (and 1.8.10)
Code
class Greeter<TData> {
constructor(options: {
a: (x: any) => TData,
b: (y: TData) => any
}) { }
}
let greeter = new Greeter({
a: () => ({ asger: 'hej' }), // no parameter
b: (y) => y.asger // TData is of type { asger: string } and this line compiles
});
let greeter = new Greeter({
a: (x) => ({ asger: 'hej' }), // with parameter
b: (y) => y.asger // TData is of type { } and this line does not compile
});Expected behavior:
I expected type inference to be the same regardless of number of parameters on the function assigned to a.
Actual behavior:
A function with one parameter makes type inference fail and type of TData be {}.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed