Skip to content

Commit 46e3fae

Browse files
committed
Changed 14.7
1 parent 27ed311 commit 46e3fae

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/03-art-of-type-arguments/14.7-string-number-union.problem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Equal, Expect } from "../helpers/type-utils";
22

3-
export const inferItemLiteral = <T extends string | number>(t: T) => {
3+
export const inferItemLiteral = <T>(t: T) => {
44
return {
55
output: t,
66
};
@@ -11,5 +11,5 @@ const result2 = inferItemLiteral(123);
1111

1212
type tests = [
1313
Expect<Equal<typeof result1, { output: "a" }>>,
14-
Expect<Equal<typeof result2, { output: 123 }>>,
14+
Expect<Equal<typeof result2, { output: 123 }>>
1515
];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Equal, Expect } from "../helpers/type-utils";
2+
3+
export const inferItemLiteral = <T extends string | number>(t: T) => {
4+
return {
5+
output: t,
6+
};
7+
};
8+
9+
const result1 = inferItemLiteral("a");
10+
const result2 = inferItemLiteral(123);
11+
12+
type tests = [
13+
Expect<Equal<typeof result1, { output: "a" }>>,
14+
Expect<Equal<typeof result2, { output: 123 }>>,
15+
];

0 commit comments

Comments
 (0)