tests/cases/compiler/promiseChaining1.ts(7,17): error TS2684: The 'this' context of type 'Chain2<S>' is not assignable to method's 'this' of type 'Chain2<T>'.
  Type 'S' is not assignable to type 'T'.
    'S' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ length: number; }'.
tests/cases/compiler/promiseChaining1.ts(7,17): error TS2684: The 'this' context of type 'Chain2<Function>' is not assignable to method's 'this' of type 'Chain2<T>'.
  Type 'Function' is not assignable to type 'T'.
    'Function' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ length: number; }'.


==== tests/cases/compiler/promiseChaining1.ts (2 errors) ====
    // same example but with constraints on each type parameter
    class Chain2<T extends { length: number }> {
        constructor(public value: T) { }
        then<S extends Function>(cb: (x: T) => S): Chain2<S> {
            var result = cb(this.value);
            // should get a fresh type parameter which each then call
            var z = this.then(x => result)/*S*/.then(x => "abc")/*Function*/.then(x => x.length)/*number*/; // Should error on "abc" because it is not a Function
                    ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type 'Chain2<S>' is not assignable to method's 'this' of type 'Chain2<T>'.
!!! error TS2684:   Type 'S' is not assignable to type 'T'.
!!! error TS2684:     'S' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ length: number; }'.
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type 'Chain2<Function>' is not assignable to method's 'this' of type 'Chain2<T>'.
!!! error TS2684:   Type 'Function' is not assignable to type 'T'.
!!! error TS2684:     'Function' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ length: number; }'.
            return new Chain2(result);
        }
    }