81 lines
3.5 KiB
Text
81 lines
3.5 KiB
Text
|
==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (20 errors) ====
|
||
|
enum E { a }
|
||
|
|
||
|
var x: any;
|
||
|
|
||
|
// invalid left operands
|
||
|
// the left operand is required to be of type Any, the String primitive type, or the Number primitive type
|
||
|
var a1: boolean;
|
||
|
var a2: void;
|
||
|
var a3: {};
|
||
|
var a4: E
|
||
|
|
||
|
var ra1 = a1 in x;
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra2 = a2 in x;
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra3 = a3 in x;
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra4 = a4 in x;
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra5 = null in x;
|
||
|
~~~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra6 = undefined in x;
|
||
|
~~~~~~~~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra7 = E.a in x;
|
||
|
~~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra8 = false in x;
|
||
|
~~~~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
var ra9 = {} in x;
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
|
||
|
// invalid right operands
|
||
|
// the right operand is required to be of type Any, an object type, or a type parameter type
|
||
|
var b1: number;
|
||
|
var b2: boolean;
|
||
|
var b3: string;
|
||
|
var b4: void;
|
||
|
|
||
|
var rb1 = x in b1;
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb2 = x in b2;
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb3 = x in b3;
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb4 = x in b4;
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb5 = x in 0;
|
||
|
~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb6 = x in false;
|
||
|
~~~~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb7 = x in '';
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb8 = x in null;
|
||
|
~~~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
var rb9 = x in undefined;
|
||
|
~~~~~~~~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|
||
|
|
||
|
// both operands are invalid
|
||
|
var rc1 = {} in '';
|
||
|
~~
|
||
|
!!! The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
|
||
|
~~
|
||
|
!!! The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
|