Skip to content

Commit 2ad098f

Browse files
committed
Finished 32
1 parent bbf451a commit 2ad098f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/07-challenges/32-narrow-with-arrays.solution.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ interface Fruit {
55
price: number;
66
}
77

8-
export const wrapFruit = <const TFruits extends readonly Fruit[]>(fruits: TFruits) => {
8+
export const wrapFruit = <const TFruits extends readonly Fruit[]>(
9+
fruits: TFruits,
10+
) => {
911
const getFruit = <TName extends TFruits[number]["name"]>(name: TName) => {
1012
return fruits.find((fruit) => fruit.name === name) as Extract<
1113
TFruits[number],
@@ -36,5 +38,5 @@ const notAllowed = fruits.getFruit("not-allowed");
3638

3739
type tests = [
3840
Expect<Equal<typeof apple, { readonly name: "apple"; readonly price: 1 }>>,
39-
Expect<Equal<typeof banana, { readonly name: "banana"; readonly price: 2 }>>
41+
Expect<Equal<typeof banana, { readonly name: "banana"; readonly price: 2 }>>,
4042
];

0 commit comments

Comments
 (0)