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

16 lines
467 B
Plaintext

==== tests/cases/compiler/callOverloadViaElementAccessExpression.ts (2 errors) ====
class C {
foo(x: number): number;
foo(x: string): string;
foo(x: any): any {
return null;
}
}
var c = new C();
var r: string = c['foo'](1);
~
!!! Type 'number' is not assignable to type 'string'.
var r2: number = c['foo']('');
~~
!!! Type 'string' is not assignable to type 'number'.