+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare var Elm: Elm;
+
+interface Elm {
+ embed(elmModule: ElmModule
, element: Node, initialValues?: Object): ElmComponent
;
+ fullscreen
(elmModule: ElmModule
, initialValues?: Object): ElmComponent
;
+ worker
(elmModule: ElmModule
, initialValues?: Object): ElmComponent
;
+}
+
+interface ElmModule
{
+}
+
+interface ElmComponent
{
+ ports: P;
+}
+
+interface PortToElm {
+ send(value: V): void;
+}
+
+interface PortFromElm {
+ subscribe(handler: (value: V) => void): void;
+ unsubscribe(handler: (value: V) => void): void;
+}
\ No newline at end of file
diff --git a/giraffe/giraffe-tests.ts b/giraffe/giraffe-tests.ts
index 70365bb59..4cd6694da 100644
--- a/giraffe/giraffe-tests.ts
+++ b/giraffe/giraffe-tests.ts
@@ -3,13 +3,13 @@
class User extends Giraffe.Model {
}
-class MainView extends Giraffe.View {
+class MainView extends Giraffe.View {
constructor(options?) {
this.appEvents = {
'startup': 'app_onStartup'
- }
- super(options)
+ }
+ super(options);
}
app_onStartup() {
@@ -23,15 +23,15 @@ class MyApp extends Giraffe.App {
this.routes= {
'': 'home'
}
- super()
+ super();
}
home() {
- this.attach( new MainView )
+ this.attach(new MainView);
}
}
var app= new MyApp();
-app.start();
\ No newline at end of file
+app.start();
diff --git a/giraffe/giraffe.d.ts b/giraffe/giraffe.d.ts
index 24c41aa24..998754898 100644
--- a/giraffe/giraffe.d.ts
+++ b/giraffe/giraffe.d.ts
@@ -38,8 +38,8 @@ declare module Giraffe {
interface AppMap {
[ cid:string ]: App;
}
- interface ViewMap {
- [ cid:string ]: View;
+ interface ViewMap {
+ [ cid:string ]: View;
}
interface StringMap {
[ def:string ]: string;
@@ -49,7 +49,7 @@ declare module Giraffe {
var apps: AppMap;
var defaultOptions: DefaultOptions;
var version: string;
- var views: ViewMap;
+ var views: ViewMap;
function bindAppEvents( instance:GiraffeObject ): GiraffeObject;
function bindDataEvents( instance:GiraffeObject ): GiraffeObject;
@@ -64,9 +64,10 @@ declare module Giraffe {
function wrapFn( obj:any, name:string, before:Function, after:Function);
- class Collection extends Backbone.Collection implements GiraffeObject {
+ class Collection extends Backbone.Collection implements GiraffeObject {
app: App;
- model: Model;
+ //model: typeof TModel;
+ model: { new (): TModel; }; // workaround
}
class Model extends Backbone.Model implements GiraffeObject {
@@ -85,46 +86,46 @@ declare module Giraffe {
reload( url:string );
}
- class View extends Backbone.View implements GiraffeObject {
+ class View extends Backbone.View implements GiraffeObject {
app: App;
appEvents: StringMap;
- children: View[];
+ children: View[];
dataEvents: StringMap;
defaultOptions: DefaultOptions;
documentTitle: string;
- parent: View;
+ parent: View;
template: any;
ui: StringMap;
- attachTo( el:any, options?:AttachmentOptions ): View;
- attach( view:View, options?:AttachmentOptions ): View;
+ attachTo( el:any, options?:AttachmentOptions ): View;
+ attach( view:View, options?:AttachmentOptions ): View;
isAttached( el:any ): boolean;
- render( options?:any ): View;
+ render( options?:any ): View;
beforeRender();
afterRender();
templateStrategy(): string;
serialize(): any;
- setParent( parent:View ): View;
+ setParent( parent:View ): View;
- addChild( child:View ): View;
- addChildren( children:View[] ): View;
- removeChild( child:View, preserve?:boolean ): View;
- removeChildren( preserve?:boolean ): View;
+ addChild( child:View ): View;
+ addChildren( children:View[] ): View;
+ removeChild( child:View, preserve?:boolean ): View;
+ removeChildren( preserve?:boolean ): View;
- detach( preserve?:boolean ): View;
- detachChildren( preserve?:boolean ): View;
+ detach( preserve?:boolean ): View;
+ detachChildren( preserve?:boolean ): View;
invoke( method:string, ...args:any[] );
- dispose(): View;
- beforeDispose(): View;
- afterDispose(): View;
+ dispose(): View;
+ beforeDispose(): View;
+ afterDispose(): View;
- static detachByElement( el:any, preserve?:boolean ): View;
- static getClosestView( el:any ): View;
- static getByCid( cid:string ): View;
+ static detachByElement( el:any, preserve?:boolean ): View;
+ static getClosestView( el:any ): View;
+ static getByCid( cid:string ): View;
static to$El( el:any, parent?:any, allowParentMatch?:boolean ): JQuery;
static setDocumentEvents( events:string[], prefix?:string ): string[];
static removeDocumentEvents( prefix?:string );
@@ -132,7 +133,7 @@ declare module Giraffe {
static setTemplateStrategy( strategy:any, instance?:any );
}
- class App extends View {
+ class App extends View {
routes: StringMap;
addInitializer( initializer:( options?:any, callback?:()=>void )=>void ): App;
@@ -146,23 +147,23 @@ declare module Giraffe {
app: App;
}
- class CollectionView extends View {
+ class CollectionView extends View {
- collection: Collection;
- modelView: View;
+ collection: Collection;
+ modelView: View;
modelViewArgs: any[];
modelViewEl: any;
renderOnChange: boolean;
- findByModel( model:Model ): View;
- addOne( model:Model ): View;
- removeOne( model:Model ): View;
+ findByModel( model:Model ): View;
+ addOne( model:Model ): View;
+ removeOne( model:Model ): View;
static getDefaults( ctx:any ): any;
}
- class FastCollectionView extends View {
- collection: Collection;
+ class FastCollectionView extends View {
+ collection: Collection;
modelTemplate: any;
modelTemplateStrategy: string;
modelEl: any;
@@ -170,11 +171,11 @@ declare module Giraffe {
modelSerialize(): any;
- addAll(): View;
- addOne( model:Model ): View;
- removeOne( model:Model ): View;
+ addAll(): View;
+ addOne( model:Model ): View;
+ removeOne( model:Model ): View;
- removeByIndex( index:number ): View;
+ removeByIndex( index:number ): View;
findElByModel( model:Model ): JQuery;
findElByIndex( index:number ): JQuery;
findModelByEl( el:any ): Model;
diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts
index f4e0926ea..c2ff9c1c7 100644
--- a/jointjs/jointjs.d.ts
+++ b/jointjs/jointjs.d.ts
@@ -38,20 +38,19 @@ declare module joint {
attr(attrs: any): Cell;
}
-
-
class Element extends Cell {
position(x: number, y: number): Element;
translate(tx: number, ty?: number): Element;
resize(width: number, height: number): Element;
rotate(angle: number, absolute): Element;
}
+
interface IDefaults {
type: string;
}
class Link extends Cell {
- defaults: IDefaults;
+ defaults(): IDefaults;
disconnect(): Link;
label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed
}
@@ -65,7 +64,7 @@ declare module joint {
linkView: LinkView;
}
- class Paper extends Backbone.View {
+ class Paper extends Backbone.View {
options: IOptions;
setDimensions(width: number, height: number);
scale(sx: number, sy?: number, ox?: number, oy?: number): Paper;
@@ -80,7 +79,8 @@ declare module joint {
class ElementView extends CellView {
scale(sx: number, sy: number);
}
- class CellView extends Backbone.View {
+
+ class CellView extends Backbone.View {
getBBox(): { x: number; y: number; width: number; height: number; };
highlight(el?: any);
unhighlight(el?: any);
@@ -94,7 +94,9 @@ declare module joint {
}
}
+
module ui { }
+
module shapes {
module basic {
class Generic extends joint.dia.Element { }
@@ -104,6 +106,7 @@ declare module joint {
class Image extends Generic { }
}
}
+
module util {
function uuid(): string;
function guid(obj: any): string;
@@ -112,4 +115,5 @@ declare module joint {
function deepMixin(objects: any[]): any;
function deepSupplement(objects: any[], defaultIndicator?: any): any;
}
+
}
diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts
index 8f1bf2527..b378dfd0a 100644
--- a/jquery/jquery.d.ts
+++ b/jquery/jquery.d.ts
@@ -1512,7 +1512,37 @@ interface JQuery {
*
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
*/
- val(func: (index: number, value: any) => any): JQuery;
+ val(func: (index: number, value: string) => string): JQuery;
+ /**
+ * Set the value of each element in the set of matched elements.
+ *
+ * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
+ */
+ val(func: (index: number, value: string[]) => string): JQuery;
+ /**
+ * Set the value of each element in the set of matched elements.
+ *
+ * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
+ */
+ val(func: (index: number, value: number) => string): JQuery;
+ /**
+ * Set the value of each element in the set of matched elements.
+ *
+ * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
+ */
+ val(func: (index: number, value: string) => string[]): JQuery;
+ /**
+ * Set the value of each element in the set of matched elements.
+ *
+ * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
+ */
+ val(func: (index: number, value: string[]) => string[]): JQuery;
+ /**
+ * Set the value of each element in the set of matched elements.
+ *
+ * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
+ */
+ val(func: (index: number, value: number) => string[]): JQuery;
/**
* Get the value of style properties for the first element in the set of matched elements.
diff --git a/knockback/knockback.d.ts b/knockback/knockback.d.ts
index 50848e684..71773ab92 100644
--- a/knockback/knockback.d.ts
+++ b/knockback/knockback.d.ts
@@ -126,8 +126,8 @@ declare module Knockback {
}
interface CollectionObservable extends KnockoutObservableArray {
- collection(colleciton: Backbone.Collection);
- collection(): Backbone.Collection;
+ collection(colleciton: Backbone.Collection);
+ collection(): Backbone.Collection;
destroy();
shareOptions(): CollectionOptions;
filters(id: any) : Backbone.Model;
@@ -163,7 +163,7 @@ declare module Knockback {
}
interface Static extends Utils {
- collectionObservable(model?: Backbone.Collection, options?: CollectionOptions): CollectionObservable;
+ collectionObservable(model?: Backbone.Collection, options?: CollectionOptions): CollectionObservable;
/** Base class for observing model attributes. */
observable(
/** the model to observe (can be null) */
diff --git a/less/less.d.ts b/less/less.d.ts
index 1ab9293c4..d5787913b 100644
--- a/less/less.d.ts
+++ b/less/less.d.ts
@@ -497,6 +497,16 @@ declare module "less" {
toCSS(env?: Options): string;
eval(): UnicodeDescriptor;
}
+
+ export class Attribute implements IInjectable {
+ constructor(value: string);
+
+ value: string;
+
+ toCSS(env?: Options): string;
+ genCSS(env: Options, output): string;
+ eval(): Attribute;
+ }
export var debugInfo: DebugInfoFunction;
export function find(obj: any[], fun: Function): any;
@@ -539,4 +549,4 @@ declare module "less" {
export function writeError(ctx, options: { color: boolean; }): void;
export var version: number[];
-}
\ No newline at end of file
+}
diff --git a/lockfile/lockfile-tests.ts b/lockfile/lockfile-tests.ts
new file mode 100644
index 000000000..49aa423d9
--- /dev/null
+++ b/lockfile/lockfile-tests.ts
@@ -0,0 +1,31 @@
+///
+
+import lockfile = require('lockfile');
+
+var bool: boolean;
+var num: number;
+var path: string;
+
+var opts: lockfile.Options;
+var callback: (err: Error) => {
+
+};
+
+opts = {
+ wait: num,
+ stale: num,
+ retries: num,
+ retryWait: num
+};
+
+lockfile.lock(path, opts, callback);
+lockfile.lock(path, callback);
+lockfile.lockSync(path, opts);
+
+lockfile.unlock(path, callback);;
+lockfile.unlockSync(path);
+
+lockfile.check(path, opts, callback);
+lockfile.check(path, callback);
+
+bool = lockfile.checkSync(path, opts);
diff --git a/lockfile/lockfile.d.ts b/lockfile/lockfile.d.ts
new file mode 100644
index 000000000..99dfbe28d
--- /dev/null
+++ b/lockfile/lockfile.d.ts
@@ -0,0 +1,24 @@
+// Type definitions for lockfile v0.4.2
+// Project: https://github.com/isaacs/lockfile
+// Definitions by: Bart van der Schoor
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module 'lockfile' {
+ export interface Options {
+ wait?: number;
+ stale?: number;
+ retries?: number;
+ retryWait?: number;
+ }
+
+ export function lock(path: string, opts: Options, callback: (err: Error) => void): void;
+ export function lock(path: string, callback: (err: Error) => void): void;
+ export function lockSync(path: string, opts: Options):void;
+
+ export function unlock(path: string, callback: (err: Error) => void): void;
+ export function unlockSync(path: string):void;
+
+ export function check(path: string, opts: Options, callback: (err: Error) => void): void;
+ export function check(path: string, callback: (err: Error) => void): void;
+ export function checkSync(path: string, opts: Options): boolean;
+}
diff --git a/lru-cache/lru-cache-tests.ts b/lru-cache/lru-cache-tests.ts
new file mode 100644
index 000000000..9121ca791
--- /dev/null
+++ b/lru-cache/lru-cache-tests.ts
@@ -0,0 +1,56 @@
+///
+
+import lru = require('lru-cache');
+
+var x: any;
+var num: number;
+var bool: boolean;
+var key: string;
+var strArr: string[];
+
+interface Foo {
+ foo(): void;
+}
+
+var foo: Foo;
+var fooArr: Foo[];
+
+var opts: lru.Options;
+opts = {
+ max: num,
+ maxAge: num,
+ stale: bool
+};
+var cache: lru.Cache = lru({
+ max: num,
+ maxAge: num,
+ length: (value: Foo) => {
+ return num
+ },
+ dispose: (key: string, value: Foo) => {
+
+ },
+ stale: bool
+});
+
+cache = lru(num);
+
+cache.set(key, foo);
+foo = cache.get(key);
+foo = cache.peek(key);
+bool = cache.has(key);
+cache.del(key);
+cache.reset();
+
+cache.forEach((value: Foo, key: string, cache: lru.Cache) => {
+
+});
+cache.forEach((value: Foo, key: string, cache: lru.Cache) => {
+
+}, x);
+cache.forEach((value, key, cache) => {
+ foo = cache.peek(key);
+});
+
+strArr = cache.keys();
+fooArr = cache.values();
diff --git a/lru-cache/lru-cache.d.ts b/lru-cache/lru-cache.d.ts
new file mode 100644
index 000000000..ae028a553
--- /dev/null
+++ b/lru-cache/lru-cache.d.ts
@@ -0,0 +1,34 @@
+// Type definitions for lru-cache v2.5.0
+// Project: https://github.com/isaacs/node-lru-cache
+// Definitions by: Bart van der Schoor
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module 'lru-cache' {
+ function LRU(opts: LRU.Options): LRU.Cache;
+ function LRU(max: number): LRU.Cache;
+
+ module LRU {
+ interface Options {
+ max?: number;
+ maxAge?: number;
+ length?: (value: T) => number;
+ dispose?: (key: string, value: T) => void;
+ stale?: boolean;
+ }
+
+ interface Cache {
+ set(key: string, value: T): void;
+ get(key: string): T;
+ peek(key: string): T;
+ has(key: string): boolean
+ del(key: string): void;
+ reset(): void;
+ forEach(iter: (value: T, key: string, cache: Cache) => void, thisp?: any): void;
+
+ keys(): string[];
+ values(): T[];
+ }
+ }
+
+ export = LRU;
+}
diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts
index 0e501f6f8..7a52d7453 100644
--- a/marionette/marionette.d.ts
+++ b/marionette/marionette.d.ts
@@ -11,49 +11,49 @@
declare module Backbone {
// Backbone.BabySitter
- class ChildViewContainer {
+ class ChildViewContainer {
constructor(initialViews?: any[]);
- add(view: View, customIndex?: number);
- findByModel(model): View;
- findByModelCid(modelCid): View;
- findByCustom(index: number): View;
- findByIndex(index: number): View;
- findByCid(cid): View;
- remove(view: View);
+ add(view: View, customIndex?: number);
+ findByModel(model): View;
+ findByModelCid(modelCid): View;
+ findByCustom(index: number): View;
+ findByIndex(index: number): View;
+ findByCid(cid): View;
+ remove(view: View);
call(method);
apply(method: any, args?: any[]);
//mixins from Collection (copied from Backbone's Collection declaration)
- all(iterator: (element: View, index: number) => boolean, context?: any): boolean;
- any(iterator: (element: View, index: number) => boolean, context?: any): boolean;
+ all(iterator: (element: View, index: number) => boolean, context?: any): boolean;
+ any(iterator: (element: View, index: number) => boolean, context?: any): boolean;
contains(value: any): boolean;
detect(iterator: (item: any) => boolean, context?: any): any;
- each(iterator: (element: View, index: number, list?: any) => void , context?: any);
- every(iterator: (element: View, index: number) => boolean, context?: any): boolean;
- filter(iterator: (element: View, index: number) => boolean, context?: any): View[];
- find(iterator: (element: View, index: number) => boolean, context?: any): View;
- first(): View;
- forEach(iterator: (element: View, index: number, list?: any) => void , context?: any);
+ each(iterator: (element: View, index: number, list?: any) => void , context?: any);
+ every(iterator: (element: View, index: number) => boolean, context?: any): boolean;
+ filter(iterator: (element: View, index: number) => boolean, context?: any): View[];
+ find(iterator: (element: View, index: number) => boolean, context?: any): View;
+ first(): View;
+ forEach(iterator: (element: View, index: number, list?: any) => void , context?: any);
include(value: any): boolean;
- initial(): View;
- initial(n: number): View[];
+ initial(): View;
+ initial(n: number): View[];
invoke(methodName: string, arguments?: any[]);
isEmpty(object: any): boolean;
- last(): View;
- last(n: number): View[];
- lastIndexOf(element: View, fromIndex?: number): number;
- map(iterator: (element: View, index: number, context?: any) => any[], context?: any): any[];
+ last(): View;
+ last(n: number): View[];
+ lastIndexOf(element: View, fromIndex?: number): number;
+ map(iterator: (element: View, index: number, context?: any) => any[], context?: any): any[];
pluck(attribute: string): any[];
- reject(iterator: (element: View, index: number) => boolean, context?: any): View[];
- rest(): View;
- rest(n: number): View[];
+ reject(iterator: (element: View, index: number) => boolean, context?: any): View[];
+ rest(): View;
+ rest(n: number): View[];
select(iterator: any, context?: any): any[];
- some(iterator: (element: View, index: number) => boolean, context?: any): boolean;
+ some(iterator: (element: View, index: number) => boolean, context?: any): boolean;
toArray(): any[];
- without(...values: any[]): View[];
+ without(...values: any[]): View[];
}
// Backbone.Wreqr
@@ -107,7 +107,7 @@ declare module Marionette {
function getOption(target, optionName): any;
function triggerMethod(name, ...args: any[]): any;
- function MonitorDOMRefresh(view: Backbone.View): void;
+ function MonitorDOMRefresh(view: Backbone.View): void;
function bindEntityEvents(target, entity, bindings);
function unbindEntityEvents(target, entity, bindings);
@@ -121,24 +121,24 @@ declare module Marionette {
close();
}
- class Region extends Backbone.Events {
+ class Region extends Backbone.Events {
- static buildRegion(regionConfig, defaultRegionType): Region;
+ static buildRegion(regionConfig, defaultRegionType): Region;
el: any;
- show(view: Backbone.View): void;
+ show(view: Backbone.View): void;
ensureEl(): void;
- open(view: Backbone.View): void;
+ open(view: Backbone.View): void;
close(): void;
- attachView(view: Backbone.View);
+ attachView(view: Backbone.View);
reset();
}
- class RegionManager extends Controller {
+ class RegionManager extends Controller {
addRegions(regionDefinitions, defaults?): any;
- addRegion(name, definition): Region;
- get (name: string): Region;
+ addRegion(name, definition): Region;
+ get(name: string): Region;
removeRegion(name): void;
removeRegions(): void;
closeRegions(): void;
@@ -146,33 +146,33 @@ declare module Marionette {
//mixins from Collection (copied from Backbone's Collection declaration)
- all(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
- any(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
+ all(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
+ any(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
contains(value: any): boolean;
detect(iterator: (item: any) => boolean, context?: any): any;
- each(iterator: (element: Region, index: number, list?: any) => void , context?: any);
- every(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
- filter(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
- find(iterator: (element: Region, index: number) => boolean, context?: any): Region;
- first(): Region;
- forEach(iterator: (element: Region, index: number, list?: any) => void , context?: any);
+ each(iterator: (element: Region, index: number, list?: any) => void , context?: any);
+ every(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
+ filter(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
+ find(iterator: (element: Region, index: number) => boolean, context?: any): Region;
+ first(): Region;
+ forEach(iterator: (element: Region, index: number, list?: any) => void , context?: any);
include(value: any): boolean;
- initial(): Region;
- initial(n: number): Region[];
+ initial(): Region;
+ initial(n: number): Region[];
invoke(methodName: string, arguments?: any[]);
isEmpty(object: any): boolean;
- last(): Region;
- last(n: number): Region[];
- lastIndexOf(element: Region, fromIndex?: number): number;
- map(iterator: (element: Region, index: number, context?: any) => any[], context?: any): any[];
+ last(): Region;
+ last(n: number): Region[];
+ lastIndexOf(element: Region, fromIndex?: number): number;
+ map(iterator: (element: Region, index: number, context?: any) => any[], context?: any): any[];
pluck(attribute: string): any[];
- reject(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
- rest(): Region;
- rest(n: number): Region[];
+ reject(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
+ rest(): Region;
+ rest(n: number): Region[];
select(iterator: any, context?: any): any[];
- some(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
+ some(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
toArray(): any[];
- without(...values: any[]): Region[];
+ without(...values: any[]): Region[];
}
class TemplateCache {
@@ -187,7 +187,7 @@ declare module Marionette {
static render(template, data): void;
}
- class View extends Backbone.View {
+ class View extends Backbone.View {
constructor(options?: any);
@@ -208,72 +208,72 @@ declare module Marionette {
triggerMethod(name, ...args: any[]): any;
}
- class ItemView extends View {
+ class ItemView extends View {
constructor(options?: any);
ui: any;
serializeData(): any;
- render(): ItemView;
+ render(): ItemView;
close();
}
- class CollectionView extends View {
+ class CollectionView extends View {
constructor(options?: any);
itemView: any;
children: any;
//_initialEvents();
- addChildView(item: View, collection: View, options?: any);
+ addChildView(item: View, collection: View, options?: any);
onShowCalled();
triggerBeforeRender();
triggerRendered();
- render(): CollectionView;
+ render(): CollectionView;
- getItemView(item: any): ItemView;
- addItemView(item: any, ItemView: ItemView, index: Number);
- addChildViewEventForwarding(view: View);
- renderItemView(view: View, index: Number);
+ getItemView(item: any): ItemView;
+ addItemView(item: any, ItemView: ItemView, index: Number);
+ addChildViewEventForwarding(view: View);
+ renderItemView(view: View, index: Number);
buildItemView(item: any, ItemViewType: any, itemViewOptions: any): any;
removeItemView(item: any);
- removeChildView(view: View);
+ removeChildView(view: View);
checkEmpty();
- appendHtml(collectionView: View, itemView: View, index: Number);
+ appendHtml(collectionView: View, itemView: View, index: Number);
close();
closeChildren();
}
- class CompositeView extends CollectionView {
+ class CompositeView extends CollectionView {
constructor(options?: any);
itemView: any;
itemViewContainer: string;
- render(): CompositeView;
+ render(): CompositeView;
appendHtml(cv: any, iv: any);
renderModel(): any;
}
- class Layout extends ItemView {
+ class Layout extends ItemView {
constructor(options?: any);
- addRegion(name: string, definition: any): Region;
+ addRegion(name: string, definition: any): Region;
addRegions(regions: any): any;
- render(): Layout;
+ render(): Layout;
removeRegion(name: string);
}
interface AppRouterOptions extends Backbone.RouterOptions {
- appRoutes: any;
- controller: any;
+ appRoutes: any;
+ controller: any;
}
class AppRouter extends Backbone.Router {
@@ -284,7 +284,7 @@ declare module Marionette {
}
- class Application extends Backbone.Events {
+ class Application extends Backbone.Events {
vent: Backbone.Wreqr.EventAggregator;
commands: Backbone.Wreqr.Commands;
@@ -297,15 +297,15 @@ declare module Marionette {
start(options?);
addRegions(regions);
closeRegions(): void;
- removeRegion(region: Region);
- getRegion(regionName: string): Region;
+ removeRegion(region: Region);
+ getRegion(regionName: string): Region;
module(moduleNames, moduleDefinition);
}
// modules mapped for convenience, but you should probably use TypeScript modules instead
- class Module extends Backbone.Events {
+ class Module extends Backbone.Events {
- constructor(moduleName: string, app: Application);
+ constructor(moduleName: string, app: Application);
submodules: any;
triggerMethod(name, ...args: any[]): any;
@@ -319,7 +319,7 @@ declare module Marionette {
}
declare module 'backbone.marionette' {
- import Backbone = require('backbone');
-
- export = Marionette;
+ import Backbone = require('backbone');
+
+ export = Marionette;
}
diff --git a/node-uuid/node-uuid.d.ts b/node-uuid/node-uuid.d.ts
index 8c287bb2e..48a342204 100644
--- a/node-uuid/node-uuid.d.ts
+++ b/node-uuid/node-uuid.d.ts
@@ -34,16 +34,19 @@ interface UUIDOptions {
interface UUID {
v1(options?: UUIDOptions, buffer?: number[], offset?: number): string
- v1(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
+ v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
v2(options?: UUIDOptions, buffer?: number[], offset?: number): string
- v2(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
+ v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
v3(options?: UUIDOptions, buffer?: number[], offset?: number): string
- v3(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
+ v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
v4(options?: UUIDOptions, buffer?: number[], offset?: number): string
- v4(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
+ v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
}
-declare var uuid: UUID;
+declare module 'uuid' {
+ var uuid: UUID;
+ export = uuid;
+}
diff --git a/node-uuid/node-uuid.tests.ts b/node-uuid/node-uuid.tests.ts
index 6e1d7bd8c..49c8f165a 100644
--- a/node-uuid/node-uuid.tests.ts
+++ b/node-uuid/node-uuid.tests.ts
@@ -1,5 +1,7 @@
///
+import uuid = require('node-uuid');
+
var uid1: string = uuid.v1()
var uid2: string = uuid.v2()
var uid3: string = uuid.v3()
diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts
new file mode 100644
index 000000000..2c4e4ec1b
--- /dev/null
+++ b/tape/tape-tests.ts
@@ -0,0 +1,106 @@
+///
+
+///
+
+import tape = require('tape');
+
+var x: any;
+var value: any;
+var err: any;
+var a: any;
+var b: any;
+var err: any;
+var num: number;
+var name: string;
+var msg: string;
+var rs: NodeJS.ReadableStream;
+
+var cb: tape.TestCase;
+var t: tape.Test;
+
+tape(name, cb);
+tape(name, (test: tape.Test) => {
+ t = test;
+});
+
+tape.skip(name, cb);
+tape.only(name, cb);
+
+rs = tape.createStream();
+rs = tape.createStream(x);
+
+var tx = tape.createHarness();
+tx(name, cb);
+tape.skip(name, cb);
+tape.only(name, cb);
+
+tape(name, (test: tape.Test) => {
+
+ test.plan(num);
+ test.end();
+
+ test.fail(msg);
+ test.pass(msg);
+ test.skip(msg);
+
+ test.ok(value, msg);
+ test.true(value, msg);
+ test.assert(value, msg);
+
+ test.notOk(value, msg);
+ test.false(value, msg);
+ test.notok(value, msg);
+
+ test.error(err, msg);
+ test.ifError(err, msg);
+ test.ifErr(err, msg);
+ test.iferror(err, msg);
+
+ test.equal(a, b, msg);
+ test.equals(a, b, msg);
+ test.isEqual(a, b, msg);
+ test.is(a, b, msg);
+ test.strictEqual(a, b, msg);
+ test.strictEquals(a, b, msg);
+
+ test.notEqual(a, b, msg);
+ test.notEquals(a, b, msg);
+ test.notStrictEqual(a, b, msg);
+ test.notStrictEquals(a, b, msg);
+ test.isNotEqual(a, b, msg);
+ test.isNot(a, b, msg);
+ test.not(a, b, msg);
+ test.doesNotEqual(a, b, msg);
+ test.notEqual(a, b, msg);
+ test.isInequal(a, b, msg);
+
+ test.deepEqual(a, b, msg);
+ test.deepEquals(a, b, msg);
+ test.isEquivalent(a, b, msg);
+ test.same(a, b, msg);
+
+ test.notDeepEqual(a, b, msg);
+ test.notEquivalent(a, b, msg);
+ test.notDeeply(a, b, msg);
+ test.notSame(a, b, msg);
+ test.isNotDeepEqual(a, b, msg);
+ test.isNotDeeply(a, b, msg);
+ test.isNotEquivalent(a, b, msg);
+ test.isInequivalent(a, b, msg);
+
+ test.deepLooseEqual(a, b, msg);
+ test.looseEqual(a, b, msg);
+ test.looseEquals(a, b, msg);
+
+ test.notDeepLooseEqual(a, b, msg);
+ test.notLooseEqual(a, b, msg);
+ test.notLooseEquals(a, b, msg);
+
+ test.throws(() => {
+
+ }, value, msg);
+
+ test.doesNotThrow(() => {
+
+ }, value, msg);
+});
diff --git a/tape/tape.d.ts b/tape/tape.d.ts
new file mode 100644
index 000000000..4746e148a
--- /dev/null
+++ b/tape/tape.d.ts
@@ -0,0 +1,161 @@
+// Type definitions for tape v2.12.3
+// Project: https://github.com/substack/tape
+// Definitions by: Bart van der Schoor
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module 'tape' {
+ export = tape;
+
+ /**
+ * Create a new test with an optional name string. cb(t) fires with the new test object t once all preceeding tests have finished. Tests execute serially.
+ */
+ function tape(name: string, cb: tape.TestCase): void;
+ module tape {
+
+ interface TestCase {
+ (test: Test): void;
+ }
+
+ /**
+ * Generate a new test that will be skipped over.
+ */
+ export function skip(name: string, cb: tape.TestCase): void;
+
+ /**
+ * Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored
+ */
+ export function only(name: string, cb: tape.TestCase): void;
+
+ /**
+ * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state.
+ */
+ export function createHarness(): typeof tape;
+ /**
+ * Create a stream of output, bypassing the default output stream that writes messages to console.log().
+ */
+ export function createStream(opts?: any): NodeJS.ReadableStream;
+
+ interface Test {
+ /**
+ * Create a subtest with a new test handle st from cb(st) inside the current test cb(st) will only fire when t finishes. Additional tests queued up after t will not be run until all subtests finish.
+ */
+ test(name: string, cb: tape.TestCase): void;
+
+ /**
+ * Declare that n assertions should be run. end() will be called automatically after the nth assertion. If there are any more assertions after the nth, or after end() is called, they will generate errors.
+ */
+ plan(n: number): void;
+
+ /**
+ * Declare the end of a test explicitly.
+ */
+ end(): void;
+
+ /**
+ * Generate a failing assertion with a message msg.
+ */
+ fail(msg?: string): void;
+
+ /**
+ * Generate a passing assertion with a message msg.
+ */
+ pass(msg?: string): void;
+
+ /**
+ * Generate an assertion that will be skipped over.
+ */
+ skip(msg?: string): void;
+
+ /**
+ * Assert that value is truthy with an optional description message msg.
+ */
+ ok(value: any, msg?: string): void;
+ true(value: any, msg?: string): void;
+ assert(value: any, msg?: string): void;
+
+ /**
+ * Assert that value is falsy with an optional description message msg.
+ */
+ notOk(value: any, msg?: string): void;
+ false(value: any, msg?: string): void;
+ notok(value: any, msg?: string): void;
+
+ /**
+ * Assert that err is falsy. If err is non-falsy, use its err.message as the description message.
+ */
+ error(err: any, msg?: string): void;
+ ifError(err: any, msg?: string): void;
+ ifErr(err: any, msg?: string): void;
+ iferror(err: any, msg?: string): void;
+
+ /**
+ * Assert that a === b with an optional description msg.
+ */
+ equal(a: any, b: any, msg?: string): void;
+ equals(a: any, b: any, msg?: string): void;
+ isEqual(a: any, b: any, msg?: string): void;
+ is(a: any, b: any, msg?: string): void;
+ strictEqual(a: any, b: any, msg?: string): void;
+ strictEquals(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that a !== b with an optional description msg.
+ */
+ notEqual(a: any, b: any, msg?: string): void;
+ notEquals(a: any, b: any, msg?: string): void;
+ notStrictEqual(a: any, b: any, msg?: string): void;
+ notStrictEquals(a: any, b: any, msg?: string): void;
+ isNotEqual(a: any, b: any, msg?: string): void;
+ isNot(a: any, b: any, msg?: string): void;
+ not(a: any, b: any, msg?: string): void;
+ doesNotEqual(a: any, b: any, msg?: string): void;
+ isInequal(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
+ */
+ deepEqual(a: any, b: any, msg?: string): void;
+ deepEquals(a: any, b: any, msg?: string): void;
+ isEquivalent(a: any, b: any, msg?: string): void;
+ same(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
+ */
+ notDeepEqual(a: any, b: any, msg?: string): void;
+ notEquivalent(a: any, b: any, msg?: string): void;
+ notDeeply(a: any, b: any, msg?: string): void;
+ notSame(a: any, b: any, msg?: string): void;
+ isNotDeepEqual(a: any, b: any, msg?: string): void;
+ isNotDeeply(a: any, b: any, msg?: string): void;
+ isNotEquivalent(a: any, b: any, msg?: string): void;
+ isInequivalent(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
+ */
+ deepLooseEqual(a: any, b: any, msg?: string): void;
+ looseEqual(a: any, b: any, msg?: string): void;
+ looseEquals(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
+ */
+ notDeepLooseEqual(a: any, b: any, msg?: string): void;
+ notLooseEqual(a: any, b: any, msg?: string): void;
+ notLooseEquals(a: any, b: any, msg?: string): void;
+
+ /**
+ * Assert that the function call fn() throws an exception.
+ */
+ throws(fn: () => void, expected: any, msg?: string): void;
+
+ /**
+ * Assert that the function call fn() does not throw an exception.
+ */
+ doesNotThrow(fn: () => void, expected: any, msg?: string): void;
+ }
+ }
+}
diff --git a/tspromise/tspromise-test.ts b/tspromise/tspromise-test.ts
new file mode 100644
index 000000000..79903f0ce
--- /dev/null
+++ b/tspromise/tspromise-test.ts
@@ -0,0 +1,21 @@
+///
+
+import Promise = require('tspromise');
+
+var MyFuncFunc = Promise.async((a: boolean, b: number) => {
+ console.log('[a] ' + a);
+ yield(Promise.waitAsync(1000));
+ console.log('[b]' + b);
+});
+
+MyFuncFunc(true, 10);
+
+Promise.all([Promise.waitAsync(10), Promise.waitAsync(20)]).then(() => {
+ return new Promise((resolve, reject) => {
+ resolve('test');
+ });
+}).then(() => {
+ throw (new Error());
+}).catch((e) => {
+ console.log(e.message);
+});
\ No newline at end of file
diff --git a/tspromise/tspromise.d.ts b/tspromise/tspromise.d.ts
new file mode 100644
index 000000000..0d1132ed1
--- /dev/null
+++ b/tspromise/tspromise.d.ts
@@ -0,0 +1,40 @@
+// Type definitions for tspromise 0.0.4
+// Project: https://github.com/soywiz/tspromise
+// Definitions by: Carlos Ballesteros Velasco
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+declare class Thenable {
+ then(onFulfilled: (value: T) => Thenable , onRejected?: (error: Error) => TR): Thenable ;
+ then (onFulfilled: (value: T) => Thenable , onRejected?: (error: Error) => void): Thenable ;
+ then (onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable ;
+ then (onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable ;
+ catch(onRejected: (error: Error) => T): Thenable;
+}
+
+interface NodeCallback {
+ (err: Error, value: T): void;
+}
+
+declare module "tspromise" {
+ class Promise extends Thenable {
+ constructor(callback: (resolve: (value?: T) => void, reject?: (error: Error) => void) => void);
+ static resolve(value?: T): Thenable;
+ static resolve(promise: Thenable): Thenable;
+ static reject(error: Error): Thenable;
+ static all(promises: Thenable[]): Thenable;
+ static async(callback: () => TR): () => Thenable ;
+ static async(callback: (p1: T1) => TR): (p1: T1) => Thenable;
+ static async(callback: (p1: T1, p2: T2) => TR): (p1: T1, p2: T2) => Thenable;
+ static async(callback: (p1: T1, p2: T2, p3: T3) => TR): (p1: T1, p2: T2, p3: T3) => Thenable;
+ static async(callback: (p1: T1, p2: T2, p3: T3, p4: T4) => TR): (p1: T1, p2: T2, p3: T3, p4: T4) => Thenable;
+ static spawn (generatorFunction: () => TR): Thenable ;
+ static rewriteFolderSync(path: string): void;
+ static waitAsync(time: number): Thenable<{}>;
+ static nfcall(obj: any, methodName: String, ...args: any[]): Thenable;
+ }
+
+ export = Promise;
+}
+
+declare function yield(promise: Thenable |