Skip to content

Commit

Permalink
Add TypeScript definitions
Browse files Browse the repository at this point in the history
Closes GH-7.
Closes GH-10.

Reviewed-by: Titus Wormer <[email protected]>
  • Loading branch information
blakeembrey authored and wooorm committed Sep 9, 2018
1 parent 0503d8e commit 6d142f4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions index.d.ts
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

0 comments on commit 6d142f4

Please sign in to comment.