diff --git a/tests/baselines/reference/comparisonOperatorWithIntersectionType.errors.txt b/tests/baselines/reference/comparisonOperatorWithIntersectionType.errors.txt new file mode 100644 index 00000000000..6e97b66123d --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIntersectionType.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts(2,1): error TS2365: Operator '>' cannot be applied to types '{ a: 1; }' and 'number'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts(5,1): error TS2365: Operator '>' cannot be applied to types '{ a: 1; } & { b: number; }' and 'number'. + + +==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts (2 errors) ==== + declare let a: { a: 1 } + a > 1; + ~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types '{ a: 1; }' and 'number'. + + declare let b: { a: 1 } & { b: number } + b > 1; + ~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types '{ a: 1; } & { b: number; }' and 'number'. + \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithIntersectionType.js b/tests/baselines/reference/comparisonOperatorWithIntersectionType.js new file mode 100644 index 00000000000..cfef7a8a244 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIntersectionType.js @@ -0,0 +1,11 @@ +//// [comparisonOperatorWithIntersectionType.ts] +declare let a: { a: 1 } +a > 1; + +declare let b: { a: 1 } & { b: number } +b > 1; + + +//// [comparisonOperatorWithIntersectionType.js] +a > 1; +b > 1; diff --git a/tests/baselines/reference/comparisonOperatorWithIntersectionType.symbols b/tests/baselines/reference/comparisonOperatorWithIntersectionType.symbols new file mode 100644 index 00000000000..33cf178c27b --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIntersectionType.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts === +declare let a: { a: 1 } +>a : Symbol(a, Decl(comparisonOperatorWithIntersectionType.ts, 0, 11)) +>a : Symbol(a, Decl(comparisonOperatorWithIntersectionType.ts, 0, 16)) + +a > 1; +>a : Symbol(a, Decl(comparisonOperatorWithIntersectionType.ts, 0, 11)) + +declare let b: { a: 1 } & { b: number } +>b : Symbol(b, Decl(comparisonOperatorWithIntersectionType.ts, 3, 11)) +>a : Symbol(a, Decl(comparisonOperatorWithIntersectionType.ts, 3, 16)) +>b : Symbol(b, Decl(comparisonOperatorWithIntersectionType.ts, 3, 27)) + +b > 1; +>b : Symbol(b, Decl(comparisonOperatorWithIntersectionType.ts, 3, 11)) + diff --git a/tests/baselines/reference/comparisonOperatorWithIntersectionType.types b/tests/baselines/reference/comparisonOperatorWithIntersectionType.types new file mode 100644 index 00000000000..4d7fa669f13 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIntersectionType.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts === +declare let a: { a: 1 } +>a : { a: 1; } +>a : 1 + +a > 1; +>a > 1 : boolean +>a : { a: 1; } +>1 : 1 + +declare let b: { a: 1 } & { b: number } +>b : { a: 1; } & { b: number; } +>a : 1 +>b : number + +b > 1; +>b > 1 : boolean +>b : { a: 1; } & { b: number; } +>1 : 1 + diff --git a/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts new file mode 100644 index 00000000000..68900e5f91a --- /dev/null +++ b/tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIntersectionType.ts @@ -0,0 +1,5 @@ +declare let a: { a: 1 } +a > 1; + +declare let b: { a: 1 } & { b: number } +b > 1;