Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Co-authored-by: cutefcc <63641648+cutefcc@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and cutefcc authored Nov 16, 2022
1 parent 7fd8982 commit e5816c3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions questions/18142-medium-all/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Returns true if all elements of the list are equal to the second parameter passed in, false if there are any mismatches.

For example

```ts
type Test1 = [1, 1, 1]
type Test2 = [1, 1, 2]

type Todo = All<Test1, 1> // should be same as true
type Todo2 = All<Test2, 1> // should be same as false
```
7 changes: 7 additions & 0 deletions questions/18142-medium-all/info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
difficulty: medium
title: All
author:
github: cutefcc
name: cutefcc
tags: array

1 change: 1 addition & 0 deletions questions/18142-medium-all/template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type All = any
13 changes: 13 additions & 0 deletions questions/18142-medium-all/test-cases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Equal, Expect } from '@type-challenges/utils'

type cases = [
Expect<Equal<All<[1, 1, 1], 1>, true>>,
Expect<Equal<All<[1, 1, 2], 1>, false>>,
Expect<Equal<All<["1", "1", "1"], "1">, true>>,
Expect<Equal<All<["1", "1", "1"], 1>, false>>,
Expect<Equal<All<[number, number, number], number>, true>>,
Expect<Equal<All<[number, number, string], number>, false>>,
Expect<Equal<All<[null, null, null], null>, true>>,
Expect<Equal<All<[[1], [1], [1]], [1]>, true>>,
Expect<Equal<All<[{}, {}, {}], {}>, true>>,
];

0 comments on commit e5816c3

Please sign in to comment.