ant-design/components/_util/warning.tsx

15 lines
330 B
TypeScript
Raw Normal View History

2019-01-12 22:19:38 +08:00
import warning from 'warning';
let warned: Record<string, boolean> = {};
export function resetWarned() {
warned = {};
}
export default (valid: boolean, component: string, message: string): void => {
if (!valid && !warned[message]) {
warning(false, `[antd: ${component}] ${message}`);
warned[message] = true;
}
};