TypeScript/tests/baselines/reference/instanceofOperator.errors.txt
2014-07-12 17:30:19 -07:00

35 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

==== tests/cases/compiler/instanceofOperator.ts (6 errors) ====
// Spec:
// The instanceof operator requires the left operand to be of type Any or an object type, and the right
// operand to be of type Any or a subtype of the Function interface type. The result is always of the
// Boolean primitive type.
class Object { }
~~~~~~
!!! Duplicate identifier 'Object'.
var obj: Object;
4 instanceof null;
~
!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
// Error and should be error
obj instanceof 4;
~
!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
Object instanceof obj;
~~~
!!! The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.
// Error on left hand side
null instanceof null;
~~~~
!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
obj instanceof Object;
undefined instanceof undefined;
~~~~~~~~~
!!! The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.