TypeScript/tests/baselines/reference/assignmentCompatability_checking-apply-member-off-of-function-interface.errors.txt

67 lines
3.3 KiB
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'String'.
2014-11-05 21:26:03 +01:00
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'string[]'.
2014-11-05 21:26:03 +01:00
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'.
Property 'apply' is missing in type 'Number'.
2014-11-05 21:26:03 +01:00
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable'.
Property 'apply' is missing in type '{}'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(23,4): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(24,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'.
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(25,4): error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'.
Property 'apply' is missing in type '{}'.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts (8 errors) ====
// 3.8.4 Assignment Compatibility
interface Applicable {
apply(blah: any); // also works for 'apply'
}
var x: Applicable;
// Should fail
x = '';
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'string' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type 'String'.
2014-07-13 01:04:16 +02:00
x = [''];
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type 'string[]'.
2014-07-13 01:04:16 +02:00
x = 4;
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'number' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type 'Number'.
2014-07-13 01:04:16 +02:00
x = {};
~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type '{}' is not assignable to type 'Applicable'.
!!! error TS2322: Property 'apply' is missing in type '{}'.
2014-07-13 01:04:16 +02:00
// Should work
function f() { };
x = f;
function fn(c: Applicable) { }
// Should Fail
fn('');
~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
2014-07-13 01:04:16 +02:00
fn(['']);
~~~~
!!! error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'Applicable'.
2014-07-13 01:04:16 +02:00
fn(4);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Applicable'.
2014-07-13 01:04:16 +02:00
fn({});
~~
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'Applicable'.
!!! error TS2345: Property 'apply' is missing in type '{}'.
2014-07-13 01:04:16 +02:00
// Should work
fn(a => { });