diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js old mode 100644 new mode 100755 index fdf9b12ed52..8178311769a --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -11,6 +11,12 @@ class C { method(@dec x: number) { } } + +function id(x: T) { + return x; +} + +export const result = id`hello world`; //// [script.ts] class A { } @@ -23,6 +29,12 @@ class C { method(@dec x: number) { } } + +function id(x: T) { + return x; +} + +const result = id`hello world`; //// [tslib.d.ts] export declare function __extends(d: Function, b: Function): void; @@ -31,6 +43,7 @@ export declare function __decorate(decorators: Function[], target: any, key?: st export declare function __param(paramIndex: number, decorator: Function): Function; export declare function __metadata(metadataKey: any, metadataValue: any): Function; export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; //// [external.js] @@ -67,6 +80,11 @@ var C = /** @class */ (function () { ], C); return C; }()); +function id(x) { + return x; +} +exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"]))); +var _a; //// [script.js] var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || @@ -78,6 +96,13 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { + if (Object.defineProperty) { + return Object.defineProperty(cooked, "raw", { value: raw }); + } + cooked.raw = raw; + return cooked; +}; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); @@ -118,3 +143,8 @@ var C = /** @class */ (function () { ], C); return C; }()); +function id(x) { + return x; +} +var result = id(_a || (_a = __makeTemplateObject(["hello world"], ["hello world"]))); +var _a; diff --git a/tests/baselines/reference/importHelpers.symbols b/tests/baselines/reference/importHelpers.symbols old mode 100644 new mode 100755 index 55ca5153e32..7b2184f93c6 --- a/tests/baselines/reference/importHelpers.symbols +++ b/tests/baselines/reference/importHelpers.symbols @@ -22,6 +22,20 @@ class C { } } +function id(x: T) { +>id : Symbol(id, Decl(external.ts, 9, 1)) +>T : Symbol(T, Decl(external.ts, 11, 12)) +>x : Symbol(x, Decl(external.ts, 11, 15)) +>T : Symbol(T, Decl(external.ts, 11, 12)) + + return x; +>x : Symbol(x, Decl(external.ts, 11, 15)) +} + +export const result = id`hello world`; +>result : Symbol(result, Decl(external.ts, 15, 12)) +>id : Symbol(id, Decl(external.ts, 9, 1)) + === tests/cases/compiler/script.ts === class A { } >A : Symbol(A, Decl(script.ts, 0, 0)) @@ -46,6 +60,20 @@ class C { } } +function id(x: T) { +>id : Symbol(id, Decl(script.ts, 9, 1)) +>T : Symbol(T, Decl(script.ts, 11, 12)) +>x : Symbol(x, Decl(script.ts, 11, 15)) +>T : Symbol(T, Decl(script.ts, 11, 12)) + + return x; +>x : Symbol(x, Decl(script.ts, 11, 15)) +} + +const result = id`hello world`; +>result : Symbol(result, Decl(script.ts, 15, 5)) +>id : Symbol(id, Decl(script.ts, 9, 1)) + === tests/cases/compiler/tslib.d.ts === export declare function __extends(d: Function, b: Function): void; >__extends : Symbol(__extends, Decl(tslib.d.ts, --, --)) @@ -89,3 +117,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge >generator : Symbol(generator, Decl(tslib.d.ts, --, --)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +>__makeTemplateObject : Symbol(__makeTemplateObject, Decl(tslib.d.ts, --, --)) +>cooked : Symbol(cooked, Decl(tslib.d.ts, --, --)) +>raw : Symbol(raw, Decl(tslib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/importHelpers.types b/tests/baselines/reference/importHelpers.types old mode 100644 new mode 100755 index 0ab8d40ee85..06b851139cf --- a/tests/baselines/reference/importHelpers.types +++ b/tests/baselines/reference/importHelpers.types @@ -22,6 +22,22 @@ class C { } } +function id(x: T) { +>id : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +export const result = id`hello world`; +>result : TemplateStringsArray +>id`hello world` : TemplateStringsArray +>id : (x: T) => T +>`hello world` : "hello world" + === tests/cases/compiler/script.ts === class A { } >A : A @@ -46,6 +62,22 @@ class C { } } +function id(x: T) { +>id : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +const result = id`hello world`; +>result : TemplateStringsArray +>id`hello world` : TemplateStringsArray +>id : (x: T) => T +>`hello world` : "hello world" + === tests/cases/compiler/tslib.d.ts === export declare function __extends(d: Function, b: Function): void; >__extends : (d: Function, b: Function) => void @@ -89,3 +121,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge >generator : Function >Function : Function +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +>__makeTemplateObject : (cooked: string[], raw: string[]) => TemplateStringsArray +>cooked : string[] +>raw : string[] +>TemplateStringsArray : TemplateStringsArray + diff --git a/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.errors.txt b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.errors.txt new file mode 100755 index 00000000000..c0931c50bb5 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/foo.ts(5,23): error TS2343: This syntax requires an imported helper named '__makeTemplateObject', but module 'tslib' has no exported member '__makeTemplateObject'. + + +==== tests/cases/compiler/foo.ts (1 errors) ==== + function id(x: T) { + return x; + } + + export const result = id `hello world`; + ~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__makeTemplateObject', but module 'tslib' has no exported member '__makeTemplateObject'. + +==== tests/cases/compiler/node_modules/tslib/index.d.ts (0 errors) ==== + export { }; + \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.js b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.js new file mode 100755 index 00000000000..453b35d98ba --- /dev/null +++ b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.js @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/taggedTemplateWithoutDeclaredHelper.ts] //// + +//// [foo.ts] +function id(x: T) { + return x; +} + +export const result = id `hello world`; + +//// [index.d.ts] +export { }; + + +//// [foo.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var tslib_1 = require("tslib"); +function id(x) { + return x; +} +exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"]))); +var _a; diff --git a/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.symbols b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.symbols new file mode 100755 index 00000000000..dcba750c890 --- /dev/null +++ b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/foo.ts === +function id(x: T) { +>id : Symbol(id, Decl(foo.ts, 0, 0)) +>T : Symbol(T, Decl(foo.ts, 0, 12)) +>x : Symbol(x, Decl(foo.ts, 0, 15)) +>T : Symbol(T, Decl(foo.ts, 0, 12)) + + return x; +>x : Symbol(x, Decl(foo.ts, 0, 15)) +} + +export const result = id `hello world`; +>result : Symbol(result, Decl(foo.ts, 4, 12)) +>id : Symbol(id, Decl(foo.ts, 0, 0)) + +=== tests/cases/compiler/node_modules/tslib/index.d.ts === +export { }; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.types b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.types new file mode 100755 index 00000000000..7e8486e3ecc --- /dev/null +++ b/tests/baselines/reference/taggedTemplateWithoutDeclaredHelper.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/foo.ts === +function id(x: T) { +>id : (x: T) => T +>T : T +>x : T +>T : T + + return x; +>x : T +} + +export const result = id `hello world`; +>result : TemplateStringsArray +>id `hello world` : TemplateStringsArray +>id : (x: T) => T +>`hello world` : "hello world" + +=== tests/cases/compiler/node_modules/tslib/index.d.ts === +export { }; +No type information for this code. +No type information for this code. \ No newline at end of file