Add types for warning

This commit is contained in:
ztplz
2019-01-12 19:22:06 +08:00
committed by 偏右
parent 2dc3fbdaef
commit ab2dd31087
5 changed files with 5 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import warning from 'warning';
import * as warning from 'warning';
const warned: { [msg: string]: boolean } = {};
const warned: Record<string, boolean> = {};
export default (valid: boolean, message: string): void => {
if (!valid && !warned[message]) {
warning(false, message);

View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import * as PropTypes from 'prop-types';
import RcDrawer from 'rc-drawer';
import createReactContext, { Context } from 'create-react-context';
import warning from 'warning';
import * as warning from 'warning';
import classNames from 'classnames';
import Icon from '../icon';
import { withConfigConsumer, ConfigConsumerProps } from '../config-provider';

View File

@@ -4,7 +4,7 @@ import RcSelect, { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps, RenderEmptyHandler } from '../config-provider';
import omit from 'omit.js';
import warning from 'warning';
import * as warning from 'warning';
import Icon from '../icon';
import { tuple } from '../_util/type';

View File

@@ -98,6 +98,7 @@
"@types/react-dom": "^16.0.11",
"@types/react-intl": "^2.3.14",
"@types/react-slick": "^0.23.2",
"@types/warning": "^3.0.0",
"@yesmeck/offline-plugin": "^5.0.5",
"ansi-styles": "^3.2.1",
"antd-theme-generator": "^1.1.4",

View File

@@ -14,8 +14,6 @@ declare module 'rc-util*';
declare module 'shallowequal';
declare module 'warning';
declare module 'css-animation*';
declare module 'rc-select';