cd0434aa76
* fix(39744): make template literals more spec compliant * Add evaluation test for template literals * Add test for template literals with source map
27 lines
794 B
TypeScript
27 lines
794 B
TypeScript
//// [classAttributeInferenceTemplate.ts]
|
|
class MyClass {
|
|
property;
|
|
property2;
|
|
|
|
constructor() {
|
|
const variable = 'something'
|
|
|
|
this.property = `foo`; // Correctly inferred as `string`
|
|
this.property2 = `foo-${variable}`; // Causes an error
|
|
|
|
const localProperty = `foo-${variable}`; // Correctly inferred as `string`
|
|
}
|
|
}
|
|
|
|
//// [classAttributeInferenceTemplate.js]
|
|
"use strict";
|
|
var MyClass = /** @class */ (function () {
|
|
function MyClass() {
|
|
var variable = 'something';
|
|
this.property = "foo"; // Correctly inferred as `string`
|
|
this.property2 = "foo-".concat(variable); // Causes an error
|
|
var localProperty = "foo-".concat(variable); // Correctly inferred as `string`
|
|
}
|
|
return MyClass;
|
|
}());
|