Closed

Description
TypeScript Version: Version 2.4.0-dev.20170517
In the code below, I am am uncertain if this is a bug or a misunderstanding on my part to do with the new, more restrictive, 'object' type.
Code
// The following produces a compiler error:
// Type 'A & B' does not satisfy the constraint 'Base'.
// Type 'A & B' is not assignable to type 'object'.
// (type parameter) B in foo<A extends Base, B extends Base>(): Foo<Base, A & B>
//
type Base = boolean|object;
type Foo<DOM, CODOM extends DOM> = (dom: DOM) => CODOM;
function foo<A extends Base, B extends Base>(): Foo<Base, A & B> // <= error at A & B
{
return <any> function(x: Base) { return x; };
}
// Removing the constraint on CODOM in type Foo2 and
// all is well.
//
type Base2 = boolean|object;
type Foo2<DOM, CODOM> = (dom: DOM) => CODOM; // <= "fixed" by removing extends DOM
function foo2<A extends Base2, B extends Base2>(): Foo2<Base2, A & B>
{
return <any> function(x: Base2) { return x; };
}
// All can also be made well by changing object to Object in
// type Base3.
//
type Base3 = boolean|Object; // <= also "fixed" by resorting to 'Object' instead of 'object'
type Foo3<DOM, CODOM extends DOM> = (dom: DOM) => CODOM;
function foo3<A extends Base3, B extends Base3>(): Foo3<Base3, A & B>
{
return <any> function(x: Base2) { return x; };
}