Skip to content

Commit

Permalink
Merge pull request #8 from andy-viv/typedefs
Browse files Browse the repository at this point in the history
Added typescript definition file
  • Loading branch information
juandopazo committed Feb 4, 2019
2 parents 7ff5735 + 95a5d27 commit 918de31
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export = Cerebro
declare class Cerebro {
static rehydrate(dehydratedObject: string): Cerebro.ICerebroConfig
constructor(config: Cerebro.ICerebroConfigEntry[], options?: Cerebro.ICerebroOptions)
resolveConfig(
context: Cerebro.ICerebroContext,
options?: Cerebro.ICerebroConfigOptions
): Cerebro.ICerebroConfig
}
declare namespace Cerebro {
interface ICerebroConfigEntry {
setting: string
value: any
except?: ICerebroConfigEntryException[]
}
type ICerebroConfigEntryException = {
value: any
[key: string]: any
}
interface ICerebroOptions {
customEvaluators?: { [key: string]: Function }
}
interface ICerebroContext {
percentageSeed: string | number
}
interface ICerebroConfigOptions {
overrides?: { [key: string]: any }
}
interface ICerebroConfig {
isEnabled(name: string): boolean
getValue(name: string): any
dehydrate(): string
getRawConfig(): { [key: string]: any }
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"buffer-crc32": "^0.2.13",
"lodash.template": "^4.4.0",
"tv4": "^1.2.7"
}
},
"types": "index.d.ts"
}

0 comments on commit 918de31

Please sign in to comment.