如果您知道TypeScript,您可能知道DefinitelyTyped。我想知道是否有类似的东西,但与.NET类似的..ts文件功能呢?
因此,例如,如果我喜欢队列--来自.NET的类--我想知道是否有人在TypeScript中执行了一个实现,我可以在那里查找它,或者如果我做了一个实现,我会知道在哪里存储它。
由于我猜大多数类型记录-用户都有.NET背景,我认为这是有意义的,我希望已经有人这样想了:)?
干杯!
发布于 2013-10-31 14:30:47
我有一个项目,其中包含了一些通用的<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] 发布于 2013-10-31 11:44:06
我用面向TypeScript程序员的C# (从InfoQ中解放出来)编写了一个泛型列表的示例实现。
TypeScript没有自己的框架类库,所以除非有计划让TypeScript团队开始开发一个类库,否则社区需要创建一个类库。好消息是,TypeScript具备所需的所有语言特性,将其模块化应该是很简单的,因此您只需要加载您需要使用的FCL元素(使用模块加载器)。例如:
import collections = require('fcl/collections');
var customers = new collections.List<Customer>();https://stackoverflow.com/questions/19704429
复制相似问题