[Chance] Constructor seed can be string (#18532)

This commit is contained in:
Justin Ryan Hurst
2017-08-01 12:32:20 -07:00
committed by Sheetal Nandi
parent 39c1801200
commit 97d4234513
2 changed files with 6 additions and 4 deletions
+1
View File
@@ -37,3 +37,4 @@ var timeString: string = chance.time();
var chanceConstructedWithSeed100 = new Chance(100);
var chanceCalledWithSeed100 = Chance()
var chanceConstructedWithStringSeed = new Chance("test")
+5 -4
View File
@@ -4,20 +4,21 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Chance {
type Seed = number | string;
interface Seeded {
seed: number;
seed: Seed;
}
type SeededChance = Chance & Seeded;
interface ChanceStatic {
(): Chance
(seed: number): SeededChance
(seed: Seed): SeededChance
(generator: () => any): Chance
new(): Chance;
new(seed: number): SeededChance;
new(seed: Seed): SeededChance;
new(generator: () => any): Chance;
}
@@ -156,7 +157,7 @@ declare namespace Chance {
// "Hidden"
cc_types(): CreditCardType[];
mersenne_twister(seed?: number): any; // API return type not defined in docs
mersenne_twister(seed?: Seed): any; // API return type not defined in docs
months(): Month[];
name_prefixes(): Name[];
provinces(): Name[];