TypeScript/tests/baselines/reference/augmentedTypeAssignmentCompatIndexSignature.errors.txt

34 lines
1.2 KiB
Plaintext

tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(15,5): error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
Index signature is missing in type '{}'.
tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts(19,5): error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
Index signature is missing in type '() => void'.
==== tests/cases/conformance/types/members/augmentedTypeAssignmentCompatIndexSignature.ts (2 errors) ====
interface Foo { a }
interface Bar { b }
interface Object {
[n: number]: Foo;
}
interface Function {
[n: number]: Bar;
}
var o = {};
var f = () => { };
var v1: {
~~
!!! error TS2322: Type '{}' is not assignable to type '{ [n: number]: Foo; }'.
!!! error TS2322: Index signature is missing in type '{}'.
[n: number]: Foo
} = o; // Should be allowed
var v2: {
~~
!!! error TS2322: Type '() => void' is not assignable to type '{ [n: number]: Bar; }'.
!!! error TS2322: Index signature is missing in type '() => void'.
[n: number]: Bar
} = f; // Should be allowed