Merge pull request #6544 from DanielRosenwasser/takeAChance

Allow 'chance' to be callable, and also self-referential as a module
This commit is contained in:
Masahiro Wakame
2015-11-02 23:29:49 +09:00
2 changed files with 12 additions and 1 deletions

View File

@@ -34,3 +34,6 @@ chance.mixin({
});
var timeString: string = chance.time();
var chanceConstructedWithSeed100 = new Chance(100);
var chanceCalledWithSeed100 = Chance()

10
chance/chance.d.ts vendored
View File

@@ -5,7 +5,10 @@
declare module Chance {
interface ChanceStatic {
Chance(): Chance;
(): Chance
(seed: number): Chance
(generator: () => any): Chance
new(): Chance;
new(seed: number): Chance;
new(generator: () => any): Chance;
@@ -209,5 +212,10 @@ declare var Chance: Chance.ChanceStatic;
// import Chance = require('chance');
declare module 'chance' {
interface ExportedChance extends Chance.ChanceStatic {
Chance: ExportedChance;
}
var Chance: ExportedChance;
export = Chance;
}