-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rajput-hemant <rajput.hemant2001@gmail.com>
- Loading branch information
1 parent
e8c99aa
commit b843d09
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Equal, Expect } from "type-testing"; | ||
|
||
type test_0_actual = SantasFavoriteCookies; | ||
// ^? | ||
type test_0_expected = "ginger-bread" | "chocolate-chip"; | ||
type test_0 = Expect<Equal<test_0_actual, test_0_expected>>; | ||
|
||
/* ----------------------------------------------------------------------------------------------- | ||
* Code Here | ||
* -----------------------------------------------------------------------------------------------*/ | ||
|
||
type SantasFavoriteCookies = "ginger-bread" | "chocolate-chip"; |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Equal, Expect } from "type-testing"; | ||
|
||
import { Increment } from "@/utils/type-helpers"; | ||
|
||
/* ----------------------------------------------------------------------------------------------- | ||
* Code Here | ||
* -----------------------------------------------------------------------------------------------*/ | ||
|
||
type DayCounter< | ||
S extends number, | ||
E extends number, | ||
I extends any[] = [any], | ||
> = S extends E | ||
? E // if start is equal to end, return end | ||
: S | DayCounter<Increment<I>["length"], E, Increment<I>>; | ||
// otherwise, union start with the result of incrementing start by 1, and recurse | ||
|
||
/* ----------------------------------------------------------------------------------------------- | ||
* Do Not Edit Below This Line | ||
* -----------------------------------------------------------------------------------------------*/ | ||
|
||
type TwelveDaysOfChristmas = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; | ||
type test_0_actual = DayCounter<1, 12>; | ||
// ^? | ||
type test_0_expected = TwelveDaysOfChristmas; | ||
type test_0 = Expect<Equal<test_0_expected, test_0_actual>>; | ||
|
||
type DaysUntilChristmas = | ||
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25; | ||
type test_1_actual = DayCounter<1, 25>; | ||
// ^? | ||
type test_1_expected = DaysUntilChristmas; | ||
type test_1 = Expect<Equal<test_1_expected, test_1_actual>>; |