Skip to content

Commit 0b7538d

Browse files
Accepted baselines.
1 parent 1841afe commit 0b7538d

7 files changed

+179
-0
lines changed

tests/baselines/reference/importHelpers.js

100644100755
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class C {
1111
method(@dec x: number) {
1212
}
1313
}
14+
15+
function id<T>(x: T) {
16+
return x;
17+
}
18+
19+
export const result = id`hello world`;
1420

1521
//// [script.ts]
1622
class A { }
@@ -23,6 +29,12 @@ class C {
2329
method(@dec x: number) {
2430
}
2531
}
32+
33+
function id<T>(x: T) {
34+
return x;
35+
}
36+
37+
const result = id`hello world`;
2638

2739
//// [tslib.d.ts]
2840
export declare function __extends(d: Function, b: Function): void;
@@ -31,6 +43,7 @@ export declare function __decorate(decorators: Function[], target: any, key?: st
3143
export declare function __param(paramIndex: number, decorator: Function): Function;
3244
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
3345
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
46+
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
3447

3548

3649
//// [external.js]
@@ -67,6 +80,11 @@ var C = /** @class */ (function () {
6780
], C);
6881
return C;
6982
}());
83+
function id(x) {
84+
return x;
85+
}
86+
exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"])));
87+
var _a;
7088
//// [script.js]
7189
var __extends = (this && this.__extends) || (function () {
7290
var extendStatics = Object.setPrototypeOf ||
@@ -78,6 +96,13 @@ var __extends = (this && this.__extends) || (function () {
7896
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7997
};
8098
})();
99+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
100+
if (Object.defineProperty) {
101+
return Object.defineProperty(cooked, "raw", { value: raw });
102+
}
103+
cooked.raw = raw;
104+
return cooked;
105+
};
81106
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
82107
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
83108
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -118,3 +143,8 @@ var C = /** @class */ (function () {
118143
], C);
119144
return C;
120145
}());
146+
function id(x) {
147+
return x;
148+
}
149+
var result = id(_a || (_a = __makeTemplateObject(["hello world"], ["hello world"])));
150+
var _a;

tests/baselines/reference/importHelpers.symbols

100644100755
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ class C {
2222
}
2323
}
2424

25+
function id<T>(x: T) {
26+
>id : Symbol(id, Decl(external.ts, 9, 1))
27+
>T : Symbol(T, Decl(external.ts, 11, 12))
28+
>x : Symbol(x, Decl(external.ts, 11, 15))
29+
>T : Symbol(T, Decl(external.ts, 11, 12))
30+
31+
return x;
32+
>x : Symbol(x, Decl(external.ts, 11, 15))
33+
}
34+
35+
export const result = id`hello world`;
36+
>result : Symbol(result, Decl(external.ts, 15, 12))
37+
>id : Symbol(id, Decl(external.ts, 9, 1))
38+
2539
=== tests/cases/compiler/script.ts ===
2640
class A { }
2741
>A : Symbol(A, Decl(script.ts, 0, 0))
@@ -46,6 +60,20 @@ class C {
4660
}
4761
}
4862

63+
function id<T>(x: T) {
64+
>id : Symbol(id, Decl(script.ts, 9, 1))
65+
>T : Symbol(T, Decl(script.ts, 11, 12))
66+
>x : Symbol(x, Decl(script.ts, 11, 15))
67+
>T : Symbol(T, Decl(script.ts, 11, 12))
68+
69+
return x;
70+
>x : Symbol(x, Decl(script.ts, 11, 15))
71+
}
72+
73+
const result = id`hello world`;
74+
>result : Symbol(result, Decl(script.ts, 15, 5))
75+
>id : Symbol(id, Decl(script.ts, 9, 1))
76+
4977
=== tests/cases/compiler/tslib.d.ts ===
5078
export declare function __extends(d: Function, b: Function): void;
5179
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
@@ -89,3 +117,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge
89117
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
90118
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
91119

120+
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
121+
>__makeTemplateObject : Symbol(__makeTemplateObject, Decl(tslib.d.ts, --, --))
122+
>cooked : Symbol(cooked, Decl(tslib.d.ts, --, --))
123+
>raw : Symbol(raw, Decl(tslib.d.ts, --, --))
124+
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --))
125+

tests/baselines/reference/importHelpers.types

100644100755
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ class C {
2222
}
2323
}
2424

25+
function id<T>(x: T) {
26+
>id : <T>(x: T) => T
27+
>T : T
28+
>x : T
29+
>T : T
30+
31+
return x;
32+
>x : T
33+
}
34+
35+
export const result = id`hello world`;
36+
>result : TemplateStringsArray
37+
>id`hello world` : TemplateStringsArray
38+
>id : <T>(x: T) => T
39+
>`hello world` : "hello world"
40+
2541
=== tests/cases/compiler/script.ts ===
2642
class A { }
2743
>A : A
@@ -46,6 +62,22 @@ class C {
4662
}
4763
}
4864

65+
function id<T>(x: T) {
66+
>id : <T>(x: T) => T
67+
>T : T
68+
>x : T
69+
>T : T
70+
71+
return x;
72+
>x : T
73+
}
74+
75+
const result = id`hello world`;
76+
>result : TemplateStringsArray
77+
>id`hello world` : TemplateStringsArray
78+
>id : <T>(x: T) => T
79+
>`hello world` : "hello world"
80+
4981
=== tests/cases/compiler/tslib.d.ts ===
5082
export declare function __extends(d: Function, b: Function): void;
5183
>__extends : (d: Function, b: Function) => void
@@ -89,3 +121,9 @@ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, ge
89121
>generator : Function
90122
>Function : Function
91123

124+
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
125+
>__makeTemplateObject : (cooked: string[], raw: string[]) => TemplateStringsArray
126+
>cooked : string[]
127+
>raw : string[]
128+
>TemplateStringsArray : TemplateStringsArray
129+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
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'.
2+
3+
4+
==== tests/cases/compiler/foo.ts (1 errors) ====
5+
function id<T>(x: T) {
6+
return x;
7+
}
8+
9+
export const result = id `hello world`;
10+
~~~~~~~~~~~~~~~~
11+
!!! error TS2343: This syntax requires an imported helper named '__makeTemplateObject', but module 'tslib' has no exported member '__makeTemplateObject'.
12+
13+
==== tests/cases/compiler/node_modules/tslib/index.d.ts (0 errors) ====
14+
export { };
15+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [tests/cases/compiler/taggedTemplateWithoutDeclaredHelper.ts] ////
2+
3+
//// [foo.ts]
4+
function id<T>(x: T) {
5+
return x;
6+
}
7+
8+
export const result = id `hello world`;
9+
10+
//// [index.d.ts]
11+
export { };
12+
13+
14+
//// [foo.js]
15+
"use strict";
16+
Object.defineProperty(exports, "__esModule", { value: true });
17+
var tslib_1 = require("tslib");
18+
function id(x) {
19+
return x;
20+
}
21+
exports.result = id(_a || (_a = tslib_1.__makeTemplateObject(["hello world"], ["hello world"])));
22+
var _a;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
=== tests/cases/compiler/foo.ts ===
2+
function id<T>(x: T) {
3+
>id : Symbol(id, Decl(foo.ts, 0, 0))
4+
>T : Symbol(T, Decl(foo.ts, 0, 12))
5+
>x : Symbol(x, Decl(foo.ts, 0, 15))
6+
>T : Symbol(T, Decl(foo.ts, 0, 12))
7+
8+
return x;
9+
>x : Symbol(x, Decl(foo.ts, 0, 15))
10+
}
11+
12+
export const result = id `hello world`;
13+
>result : Symbol(result, Decl(foo.ts, 4, 12))
14+
>id : Symbol(id, Decl(foo.ts, 0, 0))
15+
16+
=== tests/cases/compiler/node_modules/tslib/index.d.ts ===
17+
export { };
18+
No type information for this code.
19+
No type information for this code.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=== tests/cases/compiler/foo.ts ===
2+
function id<T>(x: T) {
3+
>id : <T>(x: T) => T
4+
>T : T
5+
>x : T
6+
>T : T
7+
8+
return x;
9+
>x : T
10+
}
11+
12+
export const result = id `hello world`;
13+
>result : TemplateStringsArray
14+
>id `hello world` : TemplateStringsArray
15+
>id : <T>(x: T) => T
16+
>`hello world` : "hello world"
17+
18+
=== tests/cases/compiler/node_modules/tslib/index.d.ts ===
19+
export { };
20+
No type information for this code.
21+
No type information for this code.

0 commit comments

Comments
 (0)