-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes GH-7. Closes GH-10. Reviewed-by: Titus Wormer <[email protected]>
- Loading branch information
1 parent
0503d8e
commit 6d142f4
Showing
1 changed file
with
26 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,26 @@ | ||
class List <T extends List.Item> { | ||
static of<T extends List.Item>(...items: T[]): List<T> | ||
static from<T extends List.Item>(items: T[]): List<T> | ||
|
||
head: T | null | ||
tail: T | null | ||
|
||
constructor(...items: T[]) | ||
toArray(): T[] | ||
prepend<T>(item: T): T | ||
append<T>(item: T): T | ||
} | ||
|
||
namespace List { | ||
export class Item { | ||
prev: Item | ||
next: Item | ||
list: List | ||
|
||
detach(): this | ||
prepend<T extends Item>(item: T): T | ||
append<T extends Item>(item: T): T | ||
} | ||
} | ||
|
||
export = List |