mirror of https://github.com/status-im/metro.git
declareOpts: @flow
Reviewed By: cpojer Differential Revision: D4146711 fbshipit-source-id: edd360b3dd8444c7ec5be5c69db97e1e0906a730
This commit is contained in:
parent
f1aba3f63b
commit
d25047ebf1
|
@ -15,13 +15,24 @@
|
|||
* });
|
||||
*
|
||||
* var myOptions = validate(someOptions);
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var Joi = require('joi');
|
||||
|
||||
module.exports = function(descriptor) {
|
||||
/**
|
||||
* TOut is always more specific than TIn, so it's a subtype.
|
||||
*/
|
||||
module.exports = function<TIn: {}, TOut: TIn>(
|
||||
descriptor: {[name: string]: {
|
||||
type: mixed,
|
||||
required?: boolean,
|
||||
default?: mixed,
|
||||
}},
|
||||
): (untyped: TIn) => TOut {
|
||||
var joiKeys = {};
|
||||
Object.keys(descriptor).forEach(function(prop) {
|
||||
var record = descriptor[prop];
|
||||
|
|
Loading…
Reference in New Issue