Generic .NET class (i.e. List <T>) - TypeScript implementations
If you know TypeScript, you probably know DefinitelyTyped-Repository. I was wondering if there is something similar, but with .ts .net-like-features files?
So, for example, if I like Queue-Class from .NET, and I was wondering if anyone made an implementation in TypeScript, I could find it there - or if I made an implementation, I would know where to store it.
I suppose most TypeScript -Users have .NET-Background, I think that would make sense, and I hope someone thought about it already :)?
Hurrah!
+4
2 answers
, <T> :
- Linked List
- Dictionary
- Multi Dictionary
- Binary Search Tree
- Stack
- Queue
- Set
- Bag
- Binary Heap
- Priority Queue
: https://github.com/basarat/typescript-collections
. :
/// <reference path="collections.ts" />
var x = new collections.Set<number>();
x.add(123);
x.add(123); // Duplicates not allowed in a set so will get filtered out
// The following will give error due to wrong type:
// x.add("asdf"); // Can only add numbers since that is the type argument.
var y = new collections.Set<number>();
y.add(456);
x.union(y);
console.log(x.toString()); // [123,456]
+5
TypeScript # Programmers ( InfoQ).
TypeScript Framework, , , TypeScript , . , TypeScript , , , FCL, ( ). :
import collections = require('fcl/collections');
var customers = new collections.List<Customer>();
+2