Skip to content

Commit b409888

Browse files
Added tests.
1 parent 23ed9f8 commit b409888

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// @target: esnext
2+
3+
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
4+
5+
interface Stuff {
6+
x: number;
7+
y: string;
8+
z: boolean;
9+
}
10+
11+
export const a = f<Stuff> `
12+
hello
13+
${stuff => stuff.x}
14+
brave
15+
${stuff => stuff.y}
16+
world
17+
${stuff => stuff.z}
18+
`;
19+
20+
declare function g<Input, T, U, V>(
21+
strs: TemplateStringsArray,
22+
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
23+
24+
export const b = g<Stuff, number, string, boolean> `
25+
hello
26+
${stuff => stuff.x}
27+
brave
28+
${stuff => stuff.y}
29+
world
30+
${stuff => stuff.z}
31+
`;
32+
33+
declare let obj: {
34+
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
35+
returnedObjProp: {
36+
lastOne: T
37+
}
38+
}
39+
}
40+
41+
export const c = obj["prop"]<Stuff> `${(input) => { ...input }}`
42+
c.returnedProp.x;
43+
c.returnedProp.y;
44+
c.returnedProp.z;

0 commit comments

Comments
 (0)