diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f5592560ed4..d3e119700b5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6776,7 +6776,7 @@ module ts { // 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. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (isTypeOfKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b8c842641d7..207006cdaf8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1286,6 +1286,7 @@ module ts { Unwidened = 0x00020000, // Unwidened type (is or contains Undefined or Null type) Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, + Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous,