==== tests/cases/compiler/stringIndexerConstrainsPropertyDeclarations2.ts (7 errors) ====
    // String indexer providing a constraint of a user defined type
    
    class A {
        foo(): string { return ''; }
    }
    
    class B extends A {
        bar(): string { return ''; }
    }
    
    class Foo {
        [x: string]: A;
        a: A; // ok
        b: B; // ok
        c: number; // error
        ~~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(15,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'Number' is missing property 'foo' from type 'A'.
        d: string; // error
        ~~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'String' is missing property 'foo' from type 'A'.
    }
    
    interface Foo2 {
        [x: string]: A;
        a: A; // ok
        b: B; // ok
        c: number; // error
        ~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(23,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'Number' is missing property 'foo' from type 'A'.
        d: string; // error
        ~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'String' is missing property 'foo' from type 'A'.
    }
    
    var a: {
        [x: string]: A;
        a: A; // ok
        b: B; // ok
        c: number; // error
        ~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'Number' is missing property 'foo' from type 'A'.
        d: string; // error
        ~~~~~~~~~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2172: All named properties must be assignable to string indexer type 'A':
!!! 	Type 'String' is missing property 'foo' from type 'A'.
    };
    
    // error
    var b: { [x: string]: A } = {
        ~~~~~~~~~~~~~~~~~~~~~~~~~
        a: A,
    ~~~~~~~~~
        b: B
    ~~~~~~~~
    }
    ~
!!! stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2012: Cannot convert '{ a: typeof A; b: typeof B; [x: string]: {}; }' to '{ [x: string]: A; }':
!!! 	Index signatures of types '{ a: typeof A; b: typeof B; [x: string]: {}; }' and '{ [x: string]: A; }' are incompatible:
!!! 		Type '{}' is missing property 'foo' from type 'A'.