mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Added tests and baselines for templates.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInArray.ts]
|
||||
var x = [1, 2, `abc${ 123 }def`];
|
||||
|
||||
//// [templateStringInArray.js]
|
||||
var x = [1, 2, ("abc" + 123 + "def")];
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInArray.ts ===
|
||||
var x = [1, 2, `abc${ 123 }def`];
|
||||
>x : {}[]
|
||||
>[1, 2, `abc${ 123 }def`] : {}[]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInArrowFunction.ts]
|
||||
var x = x => `abc${ x }def`;
|
||||
|
||||
//// [templateStringInArrowFunction.js]
|
||||
var x = function (x) { return ("abc" + x + "def"); };
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInArrowFunction.ts ===
|
||||
var x = x => `abc${ x }def`;
|
||||
>x : (x: any) => string
|
||||
>x => `abc${ x }def` : (x: any) => string
|
||||
>x : any
|
||||
>x : unknown
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInArrowFunctionES6.ts]
|
||||
var x = x => `abc${ x }def`;
|
||||
|
||||
//// [templateStringInArrowFunctionES6.js]
|
||||
var x = function (x) { return `abc${x}def`; };
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInArrowFunctionES6.ts ===
|
||||
var x = x => `abc${ x }def`;
|
||||
>x : (x: any) => string
|
||||
>x => `abc${ x }def` : (x: any) => string
|
||||
>x : any
|
||||
>x : unknown
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInBinaryAddition.ts]
|
||||
var x = 10 + `abc${ 10 }def`;
|
||||
|
||||
//// [templateStringInBinaryAddition.js]
|
||||
var x = 10 + ("abc" + 10 + "def");
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInBinaryAddition.ts ===
|
||||
var x = 10 + `abc${ 10 }def`;
|
||||
>x : string
|
||||
>10 + `abc${ 10 }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInBinaryAdditionES6.ts]
|
||||
var x = 10 + `abc${ 10 }def`;
|
||||
|
||||
//// [templateStringInBinaryAdditionES6.js]
|
||||
var x = 10 + `abc${10}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInBinaryAdditionES6.ts ===
|
||||
var x = 10 + `abc${ 10 }def`;
|
||||
>x : string
|
||||
>10 + `abc${ 10 }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInConditional.ts]
|
||||
var x = `abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def`;
|
||||
|
||||
//// [templateStringInConditional.js]
|
||||
var x = "abc" + " " + "def" ? "abc" + " " + "def" : "abc" + " " + "def";
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInConditional.ts ===
|
||||
var x = `abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def`;
|
||||
>x : string
|
||||
>`abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInConditionalES6.ts]
|
||||
var x = `abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def`;
|
||||
|
||||
//// [templateStringInConditionalES6.js]
|
||||
var x = `abc${" "}def` ? `abc${" "}def` : `abc${" "}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInConditionalES6.ts ===
|
||||
var x = `abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def`;
|
||||
>x : string
|
||||
>`abc${ " " }def` ? `abc${ " " }def` : `abc${ " " }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInDeleteExpression.ts]
|
||||
delete `abc${0}abc`;
|
||||
|
||||
//// [templateStringInDeleteExpression.js]
|
||||
delete ("abc" + 0 + "abc");
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts ===
|
||||
delete `abc${0}abc`;
|
||||
>delete `abc${0}abc` : boolean
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInDeleteExpressionES6.ts]
|
||||
delete `abc${0}abc`;
|
||||
|
||||
//// [templateStringInDeleteExpressionES6.js]
|
||||
delete `abc${0}abc`;
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts ===
|
||||
delete `abc${0}abc`;
|
||||
>delete `abc${0}abc` : boolean
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInDivision.ts(1,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInDivision.ts (1 errors) ====
|
||||
var x = `abc${ 1 }def` / 1;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInDivision.ts]
|
||||
var x = `abc${ 1 }def` / 1;
|
||||
|
||||
//// [templateStringInDivision.js]
|
||||
var x = ("abc" + 1 + "def") / 1;
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [templateStringInEqualityChecks.ts]
|
||||
var x = `abc${0}abc` === `abc` ||
|
||||
`abc` !== `abc${0}abc` &&
|
||||
`abc${0}abc` == "abc0abc" &&
|
||||
"abc0abc" !== `abc${0}abc`;
|
||||
|
||||
//// [templateStringInEqualityChecks.js]
|
||||
var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc";
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInEqualityChecks.ts ===
|
||||
var x = `abc${0}abc` === `abc` ||
|
||||
>x : boolean
|
||||
>`abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
|
||||
>`abc${0}abc` === `abc` : boolean
|
||||
|
||||
`abc` !== `abc${0}abc` &&
|
||||
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
|
||||
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" : boolean
|
||||
>`abc` !== `abc${0}abc` : boolean
|
||||
|
||||
`abc${0}abc` == "abc0abc" &&
|
||||
>`abc${0}abc` == "abc0abc" : boolean
|
||||
|
||||
"abc0abc" !== `abc${0}abc`;
|
||||
>"abc0abc" !== `abc${0}abc` : boolean
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [templateStringInEqualityChecksES6.ts]
|
||||
var x = `abc${0}abc` === `abc` ||
|
||||
`abc` !== `abc${0}abc` &&
|
||||
`abc${0}abc` == "abc0abc" &&
|
||||
"abc0abc" !== `abc${0}abc`;
|
||||
|
||||
//// [templateStringInEqualityChecksES6.js]
|
||||
var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`;
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInEqualityChecksES6.ts ===
|
||||
var x = `abc${0}abc` === `abc` ||
|
||||
>x : boolean
|
||||
>`abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
|
||||
>`abc${0}abc` === `abc` : boolean
|
||||
|
||||
`abc` !== `abc${0}abc` &&
|
||||
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc` : boolean
|
||||
>`abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" : boolean
|
||||
>`abc` !== `abc${0}abc` : boolean
|
||||
|
||||
`abc${0}abc` == "abc0abc" &&
|
||||
>`abc${0}abc` == "abc0abc" : boolean
|
||||
|
||||
"abc0abc" !== `abc${0}abc`;
|
||||
>"abc0abc" !== `abc${0}abc` : boolean
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [templateStringInFunctionExpression.ts]
|
||||
var x = function y() {
|
||||
`abc${ 0 }def`
|
||||
return `abc${ 0 }def`;
|
||||
};
|
||||
|
||||
//// [templateStringInFunctionExpression.js]
|
||||
var x = function y() {
|
||||
"abc" + 0 + "def";
|
||||
return "abc" + 0 + "def";
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInFunctionExpression.ts ===
|
||||
var x = function y() {
|
||||
>x : () => string
|
||||
>function y() { `abc${ 0 }def` return `abc${ 0 }def`;} : () => string
|
||||
>y : () => string
|
||||
|
||||
`abc${ 0 }def`
|
||||
return `abc${ 0 }def`;
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [templateStringInFunctionExpressionES6.ts]
|
||||
var x = function y() {
|
||||
`abc${ 0 }def`
|
||||
return `abc${ 0 }def`;
|
||||
};
|
||||
|
||||
//// [templateStringInFunctionExpressionES6.js]
|
||||
var x = function y() {
|
||||
`abc${0}def`;
|
||||
return `abc${0}def`;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInFunctionExpressionES6.ts ===
|
||||
var x = function y() {
|
||||
>x : () => string
|
||||
>function y() { `abc${ 0 }def` return `abc${ 0 }def`;} : () => string
|
||||
>y : () => string
|
||||
|
||||
`abc${ 0 }def`
|
||||
return `abc${ 0 }def`;
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,12): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,19): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,1): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts (4 errors) ====
|
||||
function f(`hello`);
|
||||
~~~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
function f(x: string);
|
||||
function f(x: string) {
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,12): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,19): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,1): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts (4 errors) ====
|
||||
function f(`hello`);
|
||||
~~~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2394: Overload signature is not compatible with function implementation.
|
||||
~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
function f(x: string);
|
||||
function f(x: string) {
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInInOperator.ts]
|
||||
var x = `${ "hi" }` in { hi: 10, hello: 20};
|
||||
|
||||
//// [templateStringInInOperator.js]
|
||||
var x = "" + "hi" + "" in { hi: 10, hello: 20 };
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInInOperator.ts ===
|
||||
var x = `${ "hi" }` in { hi: 10, hello: 20};
|
||||
>x : boolean
|
||||
>`${ "hi" }` in { hi: 10, hello: 20} : boolean
|
||||
>{ hi: 10, hello: 20} : { hi: number; hello: number; }
|
||||
>hi : number
|
||||
>hello : number
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInInOperatorES6.ts]
|
||||
var x = `${ "hi" }` in { hi: 10, hello: 20};
|
||||
|
||||
//// [templateStringInInOperatorES6.js]
|
||||
var x = `${"hi"}` in { hi: 10, hello: 20 };
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInInOperatorES6.ts ===
|
||||
var x = `${ "hi" }` in { hi: 10, hello: 20};
|
||||
>x : boolean
|
||||
>`${ "hi" }` in { hi: 10, hello: 20} : boolean
|
||||
>{ hi: 10, hello: 20} : { hi: number; hello: number; }
|
||||
>hi : number
|
||||
>hello : number
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInIndexExpression.ts]
|
||||
`abc${0}abc`[`0`];
|
||||
|
||||
//// [templateStringInIndexExpression.js]
|
||||
("abc" + 0 + "abc")["0"];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInIndexExpression.ts ===
|
||||
`abc${0}abc`[`0`];
|
||||
>`abc${0}abc`[`0`] : any
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInIndexExpressionES6.ts]
|
||||
`abc${0}abc`[`0`];
|
||||
|
||||
//// [templateStringInIndexExpressionES6.js]
|
||||
`abc${0}abc`[`0`];
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInIndexExpressionES6.ts ===
|
||||
`abc${0}abc`[`0`];
|
||||
>`abc${0}abc`[`0`] : any
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInInstanceOf.ts(1,9): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInInstanceOf.ts (1 errors) ====
|
||||
var x = `abc${ 0 }def` instanceof String;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInInstanceOf.ts]
|
||||
var x = `abc${ 0 }def` instanceof String;
|
||||
|
||||
//// [templateStringInInstanceOf.js]
|
||||
var x = "abc" + 0 + "def" instanceof String;
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInInstanceOfES6.ts(1,9): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInInstanceOfES6.ts (1 errors) ====
|
||||
var x = `abc${ 0 }def` instanceof String;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInInstanceOfES6.ts]
|
||||
var x = `abc${ 0 }def` instanceof String;
|
||||
|
||||
//// [templateStringInInstanceOfES6.js]
|
||||
var x = `abc${0}def` instanceof String;
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,16): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleName.ts(4,9): error TS2304: Cannot find name 'module'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInModuleName.ts (10 errors) ====
|
||||
declare module `M1` {
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
}
|
||||
|
||||
declare module `M${2}` {
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,16): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,16): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(1,9): error TS2304: Cannot find name 'module'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,1): error TS2304: Cannot find name 'declare'.
|
||||
tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts(4,9): error TS2304: Cannot find name 'module'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInModuleNameES6.ts (10 errors) ====
|
||||
declare module `M1` {
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
}
|
||||
|
||||
declare module `M${2}` {
|
||||
~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'declare'.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'module'.
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInModulo.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInModulo.ts (1 errors) ====
|
||||
var x = 1 % `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInModulo.ts]
|
||||
var x = 1 % `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInModulo.js]
|
||||
var x = 1 % ("abc" + 1 + "def");
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInModuloES6.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInModuloES6.ts (1 errors) ====
|
||||
var x = 1 % `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInModuloES6.ts]
|
||||
var x = 1 % `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInModuloES6.js]
|
||||
var x = 1 % `abc${1}def`;
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInMultiplication.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInMultiplication.ts (1 errors) ====
|
||||
var x = 1 * `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInMultiplication.ts]
|
||||
var x = 1 * `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInMultiplication.js]
|
||||
var x = 1 * ("abc" + 1 + "def");
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInMultiplicationES6.ts(1,13): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInMultiplicationES6.ts (1 errors) ====
|
||||
var x = 1 * `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInMultiplicationES6.ts]
|
||||
var x = 1 * `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInMultiplicationES6.js]
|
||||
var x = 1 * `abc${1}def`;
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInNewOperator.ts(1,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInNewOperator.ts (1 errors) ====
|
||||
var x = new `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInNewOperator.ts]
|
||||
var x = new `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInNewOperator.js]
|
||||
var x = new ("abc" + 1 + "def");
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts(1,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInNewOperatorES6.ts (1 errors) ====
|
||||
var x = new `abc${ 1 }def`;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInNewOperatorES6.ts]
|
||||
var x = new `abc${ 1 }def`;
|
||||
|
||||
//// [templateStringInNewOperatorES6.js]
|
||||
var x = new `abc${1}def`;
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,5): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(3,8): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInObjectLiteral.ts (3 errors) ====
|
||||
var x = {
|
||||
a: `abc${ 123 }def`,
|
||||
`b`: 321
|
||||
~~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,5): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(3,8): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInObjectLiteralES6.ts (3 errors) ====
|
||||
var x = {
|
||||
a: `abc${ 123 }def`,
|
||||
`b`: 321
|
||||
~~~
|
||||
!!! error TS1136: Property assignment expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInParentheses.ts]
|
||||
var x = (`abc${0}abc`);
|
||||
|
||||
//// [templateStringInParentheses.js]
|
||||
var x = (("abc" + 0 + "abc"));
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInParentheses.ts ===
|
||||
var x = (`abc${0}abc`);
|
||||
>x : string
|
||||
>(`abc${0}abc`) : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInParenthesesES6.ts]
|
||||
var x = (`abc${0}abc`);
|
||||
|
||||
//// [templateStringInParenthesesES6.js]
|
||||
var x = (`abc${0}abc`);
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInParenthesesES6.ts ===
|
||||
var x = (`abc${0}abc`);
|
||||
>x : string
|
||||
>(`abc${0}abc`) : string
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [templateStringInSwitchAndCase.ts]
|
||||
switch (`abc${0}abc`) {
|
||||
case `abc`:
|
||||
case `123`:
|
||||
case `abc${0}abc`:
|
||||
`def${1}def`;
|
||||
}
|
||||
|
||||
//// [templateStringInSwitchAndCase.js]
|
||||
switch ("abc" + 0 + "abc") {
|
||||
case "abc":
|
||||
case "123":
|
||||
case "abc" + 0 + "abc":
|
||||
"def" + 1 + "def";
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInSwitchAndCase.ts ===
|
||||
switch (`abc${0}abc`) {
|
||||
No type information for this code. case `abc`:
|
||||
No type information for this code. case `123`:
|
||||
No type information for this code. case `abc${0}abc`:
|
||||
No type information for this code. `def${1}def`;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [templateStringInSwitchAndCaseES6.ts]
|
||||
switch (`abc${0}abc`) {
|
||||
case `abc`:
|
||||
case `123`:
|
||||
case `abc${0}abc`:
|
||||
`def${1}def`;
|
||||
}
|
||||
|
||||
//// [templateStringInSwitchAndCaseES6.js]
|
||||
switch (`abc${0}abc`) {
|
||||
case `abc`:
|
||||
case `123`:
|
||||
case `abc${0}abc`:
|
||||
`def${1}def`;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInSwitchAndCaseES6.ts ===
|
||||
switch (`abc${0}abc`) {
|
||||
No type information for this code. case `abc`:
|
||||
No type information for this code. case `123`:
|
||||
No type information for this code. case `abc${0}abc`:
|
||||
No type information for this code. `def${1}def`;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInTypeAssertion.ts]
|
||||
var x = <any>`abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInTypeAssertion.js]
|
||||
var x = ("abc" + 123 + "def");
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeAssertion.ts ===
|
||||
var x = <any>`abc${ 123 }def`;
|
||||
>x : any
|
||||
><any>`abc${ 123 }def` : any
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInTypeAssertionES6.ts]
|
||||
var x = <any>`abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInTypeAssertionES6.js]
|
||||
var x = `abc${123}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeAssertionES6.ts ===
|
||||
var x = <any>`abc${ 123 }def`;
|
||||
>x : any
|
||||
><any>`abc${ 123 }def` : any
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInTypeOf.ts]
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInTypeOf.js]
|
||||
var x = typeof ("abc" + 123 + "def");
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeOf.ts ===
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
>x : string
|
||||
>typeof `abc${ 123 }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInTypeOfES6.ts]
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInTypeOfES6.js]
|
||||
var x = typeof `abc${123}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInTypeOfES6.ts ===
|
||||
var x = typeof `abc${ 123 }def`;
|
||||
>x : string
|
||||
>typeof `abc${ 123 }def` : string
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInUnaryPlus.ts]
|
||||
var x = +`abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInUnaryPlus.js]
|
||||
var x = +("abc" + 123 + "def");
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInUnaryPlus.ts ===
|
||||
var x = +`abc${ 123 }def`;
|
||||
>x : number
|
||||
>+`abc${ 123 }def` : number
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringInUnaryPlusES6.ts]
|
||||
var x = +`abc${ 123 }def`;
|
||||
|
||||
//// [templateStringInUnaryPlusES6.js]
|
||||
var x = +`abc${123}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInUnaryPlusES6.ts ===
|
||||
var x = +`abc${ 123 }def`;
|
||||
>x : number
|
||||
>+`abc${ 123 }def` : number
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [templateStringInWhile.ts]
|
||||
while (`abc${0}abc`) {
|
||||
`def${1}def`;
|
||||
}
|
||||
|
||||
//// [templateStringInWhile.js]
|
||||
while ("abc" + 0 + "abc") {
|
||||
"def" + 1 + "def";
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInWhile.ts ===
|
||||
while (`abc${0}abc`) {
|
||||
No type information for this code. `def${1}def`;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [templateStringInWhileES6.ts]
|
||||
while (`abc${0}abc`) {
|
||||
`def${1}def`;
|
||||
}
|
||||
|
||||
//// [templateStringInWhileES6.js]
|
||||
while (`abc${0}abc`) {
|
||||
`def${1}def`;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringInWhileES6.ts ===
|
||||
while (`abc${0}abc`) {
|
||||
No type information for this code. `def${1}def`;
|
||||
No type information for this code.}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,23 @@
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,9): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,15): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,19): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(1,11): error TS2304: Cannot find name 'gen'.
|
||||
tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts(3,13): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringInYieldKeyword.ts (5 errors) ====
|
||||
function* gen {
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'gen'.
|
||||
// Once this is supported, the inner expression does not need to be parenthesized.
|
||||
var x = yield `abc${ x }def`;
|
||||
~~~~~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedAddition.ts]
|
||||
var x = `abc${ 10 + 10 }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedAddition.js]
|
||||
var x = "abc" + (10 + 10) + "def";
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedAddition.ts ===
|
||||
var x = `abc${ 10 + 10 }def`;
|
||||
>x : string
|
||||
>10 + 10 : number
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedAdditionES6.ts]
|
||||
var x = `abc${ 10 + 10 }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedAdditionES6.js]
|
||||
var x = `abc${10 + 10}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedAdditionES6.ts ===
|
||||
var x = `abc${ 10 + 10 }def`;
|
||||
>x : string
|
||||
>10 + 10 : number
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedArray.ts]
|
||||
var x = `abc${ [1,2,3] }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedArray.js]
|
||||
var x = "abc" + [1, 2, 3] + "def";
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedArray.ts ===
|
||||
var x = `abc${ [1,2,3] }def`;
|
||||
>x : string
|
||||
>[1,2,3] : number[]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedArrayES6.ts]
|
||||
var x = `abc${ [1,2,3] }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedArrayES6.js]
|
||||
var x = `abc${[1, 2, 3]}def`;
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedArrayES6.ts ===
|
||||
var x = `abc${ [1,2,3] }def`;
|
||||
>x : string
|
||||
>[1,2,3] : number[]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedArrowFunction.ts]
|
||||
var x = `abc${ x => x }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedArrowFunction.js]
|
||||
var x = "abc" + function (x) { return x; } + "def";
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedArrowFunction.ts ===
|
||||
var x = `abc${ x => x }def`;
|
||||
>x : string
|
||||
>x => x : (x: any) => any
|
||||
>x : any
|
||||
>x : any
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [templateStringWithEmbeddedArrowFunctionES6.ts]
|
||||
var x = `abc${ x => x }def`;
|
||||
|
||||
//// [templateStringWithEmbeddedArrowFunctionES6.js]
|
||||
var x = `abc${function (x) { return x; }}def`;
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedArrowFunctionES6.ts ===
|
||||
var x = `abc${ x => x }def`;
|
||||
>x : string
|
||||
>x => x : (x: any) => any
|
||||
>x : any
|
||||
>x : any
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [templateStringWithEmbeddedComments.ts]
|
||||
`head${ // single line comment
|
||||
10
|
||||
}
|
||||
middle${
|
||||
/* Multi-
|
||||
* line
|
||||
* comment
|
||||
*/
|
||||
20
|
||||
// closing comment
|
||||
}
|
||||
tail`;
|
||||
|
||||
//// [templateStringWithEmbeddedComments.js]
|
||||
"head" + 10 + "\nmiddle" + 20 + "\ntail";
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedComments.ts ===
|
||||
`head${ // single line comment
|
||||
No type information for this code.10
|
||||
No type information for this code.}
|
||||
No type information for this code.middle${
|
||||
No type information for this code./* Multi-
|
||||
No type information for this code. * line
|
||||
No type information for this code. * comment
|
||||
No type information for this code. */
|
||||
No type information for this code. 20
|
||||
No type information for this code. // closing comment
|
||||
No type information for this code.}
|
||||
No type information for this code.tail`;
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [templateStringWithEmbeddedCommentsES6.ts]
|
||||
`head${ // single line comment
|
||||
10
|
||||
}
|
||||
middle${
|
||||
/* Multi-
|
||||
* line
|
||||
* comment
|
||||
*/
|
||||
20
|
||||
// closing comment
|
||||
}
|
||||
tail`;
|
||||
|
||||
//// [templateStringWithEmbeddedCommentsES6.js]
|
||||
"head" + 10 + "\nmiddle" + 20 + "\ntail";
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/es6/templates/templateStringWithEmbeddedCommentsES6.ts ===
|
||||
`head${ // single line comment
|
||||
No type information for this code.10
|
||||
No type information for this code.}
|
||||
No type information for this code.middle${
|
||||
No type information for this code./* Multi-
|
||||
No type information for this code. * line
|
||||
No type information for this code. * comment
|
||||
No type information for this code. */
|
||||
No type information for this code. 20
|
||||
No type information for this code. // closing comment
|
||||
No type information for this code.}
|
||||
No type information for this code.tail`;
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/templates/templateStringWithEmbeddedConditional.ts(1,16): error TS2367: No best common type exists between 'boolean' and 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/templates/templateStringWithEmbeddedConditional.ts (1 errors) ====
|
||||
var x = `abc${ true ? false : " " }def`;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2367: No best common type exists between 'boolean' and 'string'.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user