rosie typing files

This commit is contained in:
Abner Oliveira
2015-09-27 09:35:26 -03:00
parent 7a3ca1f0b8
commit 81ccb3d413
2 changed files with 46 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
///<reference path="./rosie.d.ts" />
let resultObj: Object;
let resultFactory: rosie.IFactory;
declare var Factory:rosie.IFactoryStatic;
resultFactory = Factory.define('person').attr('name', 'John').sequence('id');
resultObj = Factory.build('person');
resultFactory = Factory.define('some').sequence('id').attr('name', ['id'], (id: number) => { return 'Name ' + id.toString() });
resultObj = Factory.build('some');
var rosieFactory = require('rosie').Factory;
+30
View File
@@ -0,0 +1,30 @@
declare module 'rosie' {
export = rosie;
}
declare module rosie {
interface IFactoryStatic {
define(name: String, constructor?: Function): IFactory;
build(name: string, attributes?: any[], options?: Object): Object;
buildList(name: string, size: number, attributes?: any[], options?: Object): Object[];
attributes(attributes: Object, options?: Object): Object;
options(options: Object): Object;
extend(name: string): IFactory;
}
interface IFactory {
attr(name: string, dependenciesOrValue: any | string[], value?: any): IFactory;
sequence(name: string, dependencies?: string[], builder?: Function) : IFactory;
}
}