diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt new file mode 100644 index 00000000000..f43cbd0042a --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt @@ -0,0 +1,123 @@ +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(10,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(12,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(22,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(23,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(24,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(25,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (28 errors) ==== + var temp: any; + + // Error: incorrect type on left-hand side + (! --temp) ** 3; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp--) ** 3; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!3) ** 4; + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp++) ** 4; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp--) ** 4; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (! --temp) ** 3 ** 1; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp--) ** 3 ** 1; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!3) ** 4 ** 1; + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp++) ** 4 ** 1; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (!temp--) ** 4 ** 1; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (typeof --temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (typeof temp--) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (typeof 3) ** 4; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (typeof temp++) ** 4; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (typeof temp--) ** 4; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + 1 ** (typeof --temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (typeof temp--) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (typeof 3) ** 4; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (typeof temp++) ** 4; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (typeof temp--) ** 4; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (delete --temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (delete ++temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (delete temp--) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + (delete temp++) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + 1 ** (delete --temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (delete ++temp) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (delete temp--) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 1 ** (delete temp++) ** 3; + ~~~~~~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.js b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.js new file mode 100644 index 00000000000..8977ea10eed --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.js @@ -0,0 +1,69 @@ +//// [exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts] +var temp: any; + +// Error: incorrect type on left-hand side +(! --temp) ** 3; +(!temp--) ** 3; +(!3) ** 4; +(!temp++) ** 4; +(!temp--) ** 4; + +(! --temp) ** 3 ** 1; +(!temp--) ** 3 ** 1; +(!3) ** 4 ** 1; +(!temp++) ** 4 ** 1; +(!temp--) ** 4 ** 1; + +(typeof --temp) ** 3; +(typeof temp--) ** 3; +(typeof 3) ** 4; +(typeof temp++) ** 4; +(typeof temp--) ** 4; + +1 ** (typeof --temp) ** 3; +1 ** (typeof temp--) ** 3; +1 ** (typeof 3) ** 4; +1 ** (typeof temp++) ** 4; +1 ** (typeof temp--) ** 4; + +(delete --temp) ** 3; +(delete ++temp) ** 3; +(delete temp--) ** 3; +(delete temp++) ** 3; + +1 ** (delete --temp) ** 3; +1 ** (delete ++temp) ** 3; +1 ** (delete temp--) ** 3; +1 ** (delete temp++) ** 3; + +//// [exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.js] +var temp; +// Error: incorrect type on left-hand side +Math.pow((!--temp), 3); +Math.pow((!temp--), 3); +Math.pow((!3), 4); +Math.pow((!temp++), 4); +Math.pow((!temp--), 4); +Math.pow((!--temp), Math.pow(3, 1)); +Math.pow((!temp--), Math.pow(3, 1)); +Math.pow((!3), Math.pow(4, 1)); +Math.pow((!temp++), Math.pow(4, 1)); +Math.pow((!temp--), Math.pow(4, 1)); +Math.pow((typeof --temp), 3); +Math.pow((typeof temp--), 3); +Math.pow((typeof 3), 4); +Math.pow((typeof temp++), 4); +Math.pow((typeof temp--), 4); +Math.pow(1, Math.pow((typeof --temp), 3)); +Math.pow(1, Math.pow((typeof temp--), 3)); +Math.pow(1, Math.pow((typeof 3), 4)); +Math.pow(1, Math.pow((typeof temp++), 4)); +Math.pow(1, Math.pow((typeof temp--), 4)); +Math.pow((delete --temp), 3); +Math.pow((delete ++temp), 3); +Math.pow((delete temp--), 3); +Math.pow((delete temp++), 3); +Math.pow(1, Math.pow((delete --temp), 3)); +Math.pow(1, Math.pow((delete ++temp), 3)); +Math.pow(1, Math.pow((delete temp--), 3)); +Math.pow(1, Math.pow((delete temp++), 3)); diff --git a/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.errors.txt b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.errors.txt new file mode 100644 index 00000000000..53379f29933 --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(2,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(3,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(4,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(5,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(6,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(8,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(9,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(12,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(13,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(14,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalid.ts (12 errors) ==== + + var a = 1 ** `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b = 1 ** `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c = 1 ** `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d = 1 ** `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e = `${ 3 }` ** 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f = `2${ 3 }` ** 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g = `${ 3 }4` ** 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h = `2${ 3 }4` ** 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var k = 10; + k **= `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + k **= `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + k **= `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + k **= `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + + \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.js b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.js new file mode 100644 index 00000000000..5bd9a9609a0 --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalid.js @@ -0,0 +1,34 @@ +//// [exponentiationOperatorWithTemplateStringInvalid.ts] + +var a = 1 ** `${ 3 }`; +var b = 1 ** `2${ 3 }`; +var c = 1 ** `${ 3 }4`; +var d = 1 ** `2${ 3 }4`; +var e = `${ 3 }` ** 5; +var f = `2${ 3 }` ** 5; +var g = `${ 3 }4` ** 5; +var h = `2${ 3 }4` ** 5; + +var k = 10; +k **= `${ 3 }`; +k **= `2${ 3 }`; +k **= `2${ 3 }4`; +k **= `2${ 3 }4`; + + + + +//// [exponentiationOperatorWithTemplateStringInvalid.js] +var a = Math.pow(1, "" + 3); +var b = Math.pow(1, "2" + 3); +var c = Math.pow(1, 3 + "4"); +var d = Math.pow(1, "2" + 3 + "4"); +var e = Math.pow("" + 3, 5); +var f = Math.pow("2" + 3, 5); +var g = Math.pow(3 + "4", 5); +var h = Math.pow("2" + 3 + "4", 5); +var k = 10; +k = Math.pow(k, "" + 3); +k = Math.pow(k, "2" + 3); +k = Math.pow(k, "2" + 3 + "4"); +k = Math.pow(k, "2" + 3 + "4"); diff --git a/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.errors.txt b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.errors.txt new file mode 100644 index 00000000000..39ade9df205 --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(2,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(3,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(4,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(5,14): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(6,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(8,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(9,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(12,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(13,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(14,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(15,1): error TS2304: Cannot find name 'kj'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts(15,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithTemplateStringInvalidES6.ts (13 errors) ==== + + var a = 1 ** `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var b = 1 ** `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var c = 1 ** `${ 3 }4`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var d = 1 ** `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var e = `${ 3 }` ** 5; + ~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var f = `2${ 3 }` ** 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var g = `${ 3 }4` ** 5; + ~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + var h = `2${ 3 }4` ** 5; + ~~~~~~~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + var k = 10; + k **= `${ 3 }`; + ~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + k **= `2${ 3 }`; + ~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + k **= `2${ 3 }4`; + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + kj **= `2${ 3 }4`; + ~~ +!!! error TS2304: Cannot find name 'kj'. + ~~~~~~~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.js b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.js new file mode 100644 index 00000000000..cde5133039f --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithTemplateStringInvalidES6.js @@ -0,0 +1,31 @@ +//// [exponentiationOperatorWithTemplateStringInvalidES6.ts] + +var a = 1 ** `${ 3 }`; +var b = 1 ** `2${ 3 }`; +var c = 1 ** `${ 3 }4`; +var d = 1 ** `2${ 3 }4`; +var e = `${ 3 }` ** 5; +var f = `2${ 3 }` ** 5; +var g = `${ 3 }4` ** 5; +var h = `2${ 3 }4` ** 5; + +var k = 10; +k **= `${ 3 }`; +k **= `2${ 3 }`; +k **= `2${ 3 }4`; +kj **= `2${ 3 }4`; + +//// [exponentiationOperatorWithTemplateStringInvalidES6.js] +var a = Math.pow(1, `${3}`); +var b = Math.pow(1, `2${3}`); +var c = Math.pow(1, `${3}4`); +var d = Math.pow(1, `2${3}4`); +var e = Math.pow(`${3}`, 5); +var f = Math.pow(`2${3}`, 5); +var g = Math.pow(`${3}4`, 5); +var h = Math.pow(`2${3}4`, 5); +var k = 10; +k = Math.pow(k, `${3}`); +k = Math.pow(k, `2${3}`); +k = Math.pow(k, `2${3}4`); +kj = Math.pow(kj, `2${3}4`);