react-winjs.js
function typeToPropType(typeInfo) {
    if (typeInfo.type === "string") {
        return React.PropTypes.string;
    } else if (typeInfo.type === "boolean") {
        return React.PropTypes.bool;
    } else if (typeInfo.type === "number") {
        return React.PropTypes.number;
    } else if (typeInfo.type === "enum") {
        return React.PropTypes.oneOf(typeInfo.values);
    } else if (typeInfo.type === "any") {
        return React.PropTypes.any;
    } else if (typeInfo.type === "reference") {
        if (typeInfo.name === "Function") {
            return React.PropTypes.func;
        } else if (typeInfo.name === "Array") {
            var itemPropType = typeToPropType(typeInfo.typeArguments[0]);
            return itemPropType ? React.PropTypes.arrayOf(itemPropType) : React.PropTypes.array;
        } else if (getIn(window, typeInfo.name)) {
            var instance = getIn(window, typeInfo.name);
            return React.PropTypes.instanceOf(instance);
        }
    } else {
        console.warn("react-winjs typeToPropType: unable to find propType for type: " + JSON.stringify(typeInfo, null, 2));
    }
}
function typeToPropType(typeInfo) {
    if (typeInfo.type === "string") {
        return React.PropTypes.string;
    } else if (typeInfo.type === "boolean") {
        return React.PropTypes.bool;
    } else if (typeInfo.type === "number") {
        return React.PropTypes.number;
    } else if (typeInfo.type === "enum") {
        return React.PropTypes.oneOf(typeInfo.values);
    } else if (typeInfo.type === "any") {
        return React.PropTypes.any;
    } else if (typeInfo.type === "reference") {
        if (typeInfo.name === "Function") {
            return React.PropTypes.func;
        } else if (typeInfo.name === "Array") {
            var itemPropType = typeToPropType(typeInfo.typeArguments[0]);
            return itemPropType ? React.PropTypes.arrayOf(itemPropType) : React.PropTypes.array;
        } else if (getIn(window, typeInfo.name)) {
            var instance = getIn(window, typeInfo.name);
            return React.PropTypes.instanceOf(instance);
        }
    } else {
        console.warn("react-winjs typeToPropType: unable to find propType for type: " + JSON.stringify(typeInfo, null, 2));
    }
}
function typeToPropType ( typeInfo ) { if ( typeInfo . type === "string" ) { return React . PropTypes . string ; } else if ( typeInfo . type === "boolean" ) { return React . PropTypes . bool ; } else if ( typeInfo . type === "number" ) { return React . PropTypes . number ; } else if ( typeInfo . type === "enum" ) { return React . PropTypes . oneOf ( typeInfo . values ) ; } else if ( typeInfo . type === "any" ) { return React . PropTypes . any ; } else if ( typeInfo . type === "reference" ) { if ( typeInfo . name === "Function" ) { return React . PropTypes . func ; } else if ( typeInfo . name === "Array" ) { var itemPropType = typeToPropType ( typeInfo . typeArguments [ 0 ] ) ; return itemPropType ? React . PropTypes . arrayOf ( itemPropType ) : React . PropTypes . array ; } else if ( getIn ( window , typeInfo . name ) ) { var instance = getIn ( window , typeInfo . name ) ; return React . PropTypes . instanceOf ( instance ) ; } } else { console . warn ( "react-winjs typeToPropType: unable to find propType for type: " + JSON . stringify ( typeInfo , null , 2 ) ) ; } }
Given a type from RawControlApis returns a React propType.
Given a type from RawControlApis returns a React propType .