victory-core
Version:
27 lines • 1.18 kB
TypeScript
import * as React from "react";
type SafeAttribute = string;
/**
* Asserts that value is not null or undefined, throwing an error if it is.
* @param value The value to assert
* @param message The error message to throw
*/
export declare function assert<T>(value: T, message?: string): asserts value is NonNullable<T>;
/**
* getSafeUserProps - function that takes in a props object and removes any
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
* object.
*
* @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
* @returns {Object}: object containing remaining acceptable props
*/
export declare const getSafeUserProps: <T>(props: T extends Record<string, any> ? T : never) => Record<SafeAttribute, string>;
/**
* Wraps a component and adds safe user props
*
* @param {ReactElement} component: parent component
* @param {Object} props: props to be filtered
* @returns {ReactElement} modified component
*/
export declare const withSafeUserProps: (component: React.ReactElement, props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
export {};
//# sourceMappingURL=user-props.d.ts.map